Skip to content

Commit e12d04e

Browse files
committed
Minor test refactoring for more stable output
1 parent e8d26b0 commit e12d04e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicDeduction.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ static enum Enum3711 { A, B }
7373
/**********************************************************
7474
*/
7575

76-
private static final String deadCatJson = a2q("{'name':'Felix','causeOfDeath':'entropy'}");
77-
private static final String liveCatJson = a2q("{'name':'Felix','angry':true}");
76+
private static final String deadCatJson = a2q("{'causeOfDeath':'entropy','name':'Felix'}");
77+
private static final String liveCatJson = a2q("{'angry':true,'name':'Felix'}");
7878
private static final String luckyCatJson = a2q("{'name':'Felix','angry':true,'lives':8}");
7979
private static final String ambiguousCatJson = a2q("{'name':'Felix','age':2}");
8080
private static final String fleabagJson = a2q("{}");
@@ -92,7 +92,9 @@ static enum Enum3711 { A, B }
9292
/**********************************************************
9393
*/
9494

95-
private final ObjectMapper MAPPER = newJsonMapper();
95+
private final ObjectMapper MAPPER = jsonMapperBuilder()
96+
.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)
97+
.build();
9698

9799
@Test
98100
public void testSimpleInference() throws Exception {

src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypeNames.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ static class B1616 extends Base1616 { }
4444
/**********************************************************
4545
*/
4646

47-
private final ObjectMapper MAPPER = newJsonMapper();
47+
private final ObjectMapper MAPPER = jsonMapperBuilder()
48+
.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)
49+
.build();
4850

4951
@Test
5052
public void testBaseTypeId1616() throws Exception
@@ -72,7 +74,7 @@ public void testSerialization() throws Exception
7274
// static type on serialization. If we had root static types,
7375
// could use those; but at the moment root type is dynamic
7476

75-
assertEquals("[{\"doggy\":{\"name\":\"Spot\",\"ageInYears\":3}}]",
77+
assertEquals("[{\"doggy\":{\"ageInYears\":3,\"name\":\"Spot\"}}]",
7678
MAPPER.writeValueAsString(new Animal[] { new Dog("Spot", 3) }));
7779
assertEquals("[{\"MaineCoon\":{\"name\":\"Belzebub\",\"purrs\":true}}]",
7880
MAPPER.writeValueAsString(new Animal[] { new MaineCoon("Belzebub", true)}));

0 commit comments

Comments
 (0)