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 }
7171 /**********************************************************
7272 */
7373
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' }" );
7676 private static final String luckyCatJson = a2q ("{'name':'Felix','angry':true,'lives':8}" );
7777 private static final String ambiguousCatJson = a2q ("{'name':'Felix','age':2}" );
7878 private static final String fleabagJson = a2q ("{}" );
@@ -90,7 +90,9 @@ static enum Enum3711 { A, B }
9090 /**********************************************************
9191 */
9292
93- private final ObjectMapper MAPPER = newJsonMapper ();
93+ private final ObjectMapper MAPPER = jsonMapperBuilder ()
94+ .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY )
95+ .build ();
9496
9597 @ Test
9698 public void testSimpleInference () throws Exception {
Original file line number Diff line number Diff 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 )}));
You can’t perform that action at this time.
0 commit comments