File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/test/java/com/fasterxml/jackson/databind/jsontype Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ static enum Enum3711 { A, B }
73
73
/**********************************************************
74
74
*/
75
75
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' }" );
78
78
private static final String luckyCatJson = a2q ("{'name':'Felix','angry':true,'lives':8}" );
79
79
private static final String ambiguousCatJson = a2q ("{'name':'Felix','age':2}" );
80
80
private static final String fleabagJson = a2q ("{}" );
@@ -92,7 +92,9 @@ static enum Enum3711 { A, B }
92
92
/**********************************************************
93
93
*/
94
94
95
- private final ObjectMapper MAPPER = newJsonMapper ();
95
+ private final ObjectMapper MAPPER = jsonMapperBuilder ()
96
+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
97
+ .build ();
96
98
97
99
@ Test
98
100
public void testSimpleInference () throws Exception {
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ static class B1616 extends Base1616 { }
44
44
/**********************************************************
45
45
*/
46
46
47
- private final ObjectMapper MAPPER = newJsonMapper ();
47
+ private final ObjectMapper MAPPER = jsonMapperBuilder ()
48
+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
49
+ .build ();
48
50
49
51
@ Test
50
52
public void testBaseTypeId1616 () throws Exception
@@ -72,7 +74,7 @@ public void testSerialization() throws Exception
72
74
// static type on serialization. If we had root static types,
73
75
// could use those; but at the moment root type is dynamic
74
76
75
- assertEquals ("[{\" doggy\" :{\" name \" :\" Spot \" , \" ageInYears \" :3 }}]" ,
77
+ assertEquals ("[{\" doggy\" :{\" ageInYears \" :3, \" name \" : \" Spot \" }}]" ,
76
78
MAPPER .writeValueAsString (new Animal [] { new Dog ("Spot" , 3 ) }));
77
79
assertEquals ("[{\" MaineCoon\" :{\" name\" :\" Belzebub\" ,\" purrs\" :true}}]" ,
78
80
MAPPER .writeValueAsString (new Animal [] { new MaineCoon ("Belzebub" , true )}));
You can’t perform that action at this time.
0 commit comments