|
100 | 100 | * @author Mark Paluch |
101 | 101 | * @author Golam Mazid Sajib |
102 | 102 | * @author John Blum |
| 103 | + * @author Edwin Ing |
103 | 104 | */ |
104 | 105 | @ExtendWith(MockitoExtension.class) |
105 | 106 | class MappingRedisConverterUnitTests { |
@@ -1080,7 +1081,15 @@ void writeShouldHonorCustomConversionOnNestedType() { |
1080 | 1081 | address.city = "unknown"; |
1081 | 1082 | rand.address = address; |
1082 | 1083 |
|
1083 | | - assertThat(write(rand)).containsEntry("address", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); |
| 1084 | + ObjectMapper mapper = new ObjectMapper(); |
| 1085 | + assertThat(write(rand)) |
| 1086 | + .hasEntrySatisfying("address", addr -> { |
| 1087 | + try { |
| 1088 | + assertThat(mapper.readTree(addr)).isEqualTo(mapper.readTree("{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}")); |
| 1089 | + } catch (Exception e) { |
| 1090 | + throw new AssertionError("Error during JSON comparison: " + e.getMessage(), e); |
| 1091 | + } |
| 1092 | + }); |
1084 | 1093 | } |
1085 | 1094 |
|
1086 | 1095 | @Test // DATAREDIS-425 |
@@ -1775,7 +1784,15 @@ void writeShouldWritePartialUpdatePathWithRegisteredCustomConversionCorrectly() |
1775 | 1784 |
|
1776 | 1785 | PartialUpdate<Person> update = new PartialUpdate<>("123", Person.class).set("address", address); |
1777 | 1786 |
|
1778 | | - assertThat(write(update)).containsEntry("address", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); |
| 1787 | + ObjectMapper mapper = new ObjectMapper(); |
| 1788 | + assertThat(write(update)) |
| 1789 | + .hasEntrySatisfying("address", addr -> { |
| 1790 | + try { |
| 1791 | + assertThat(mapper.readTree(addr)).isEqualTo(mapper.readTree("{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}")); |
| 1792 | + } catch (Exception e) { |
| 1793 | + throw new AssertionError("Error during JSON comparison: " + e.getMessage(), e); |
| 1794 | + } |
| 1795 | + }); |
1779 | 1796 | } |
1780 | 1797 |
|
1781 | 1798 | @Test // DATAREDIS-471 |
|
0 commit comments