File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/test/java/tools/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 @@ -71,8 +71,8 @@ static enum Enum3711 { A, B }
71
71
/**********************************************************
72
72
*/
73
73
74
- private static final String deadCatJson = a2q ("{'name ':'Felix ','causeOfDeath ':'entropy '}" );
75
- private static final String liveCatJson = a2q ("{'name':'Felix','angry':true }" );
74
+ private static final String deadCatJson = a2q ("{'causeOfDeath ':'entropy ','name ':'Felix '}" );
75
+ private static final String liveCatJson = a2q ("{'angry':true,'name':'Felix' }" );
76
76
private static final String luckyCatJson = a2q ("{'name':'Felix','angry':true,'lives':8}" );
77
77
private static final String ambiguousCatJson = a2q ("{'name':'Felix','age':2}" );
78
78
private static final String fleabagJson = a2q ("{}" );
@@ -90,7 +90,9 @@ static enum Enum3711 { A, B }
90
90
/**********************************************************
91
91
*/
92
92
93
- private final ObjectMapper MAPPER = newJsonMapper ();
93
+ private final ObjectMapper MAPPER = jsonMapperBuilder ()
94
+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
95
+ .build ();
94
96
95
97
@ Test
96
98
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