1- package com .fasterxml .jackson .databind .deser .jdk ;
1+ package com .fasterxml .jackson .databind .jsontype .jdk ;
2+
3+ import static com .fasterxml .jackson .databind .BaseMapTest .jsonMapperBuilder ;
4+ import static com .fasterxml .jackson .databind .BaseTest .a2q ;
25
36import java .util .HashMap ;
47import java .util .Map ;
1013import org .junit .jupiter .api .Assertions ;
1114import org .junit .jupiter .api .Test ;
1215
13- import static com .fasterxml .jackson .databind .BaseMapTest .jsonMapperBuilder ;
14- import static com .fasterxml .jackson .databind .BaseTest .a2q ;
15-
1616/**
1717 * Unit test proving that below issue is fixed.
1818 * <p>
@@ -27,11 +27,11 @@ public class BigDecimalForFloatDisabled3133Test
2727 property = "type" )
2828
2929 @ JsonSubTypes ({
30- @ JsonSubTypes .Type (value = TestMapContainer .class , name = "MAP" ),
30+ @ JsonSubTypes .Type (value = TestMapContainer3133 .class , name = "MAP" ),
3131 })
32- interface TestJsonTypeInfoInterface { }
32+ interface BaseType3133 { }
3333
34- static class TestMapContainer implements TestJsonTypeInfoInterface {
34+ static class TestMapContainer3133 implements BaseType3133 {
3535
3636 private Map <String , ? extends Object > map = new HashMap <>();
3737
@@ -48,16 +48,18 @@ public void setMap(Map<String, ? extends Object> map) {
4848 .disable (DeserializationFeature .USE_BIG_DECIMAL_FOR_FLOATS )
4949 .build ();
5050
51+ // [databind#3133]
5152 @ Test
52- public void testDeserializeWithDifferentOrdering () throws Exception {
53+ public void testDeserializeWithDifferentOrdering3133 () throws Exception
54+ {
5355 // case 1 : type first
5456 String ordering1 = a2q ("{'type': 'MAP','map': { 'doubleValue': 0.1 }}" );
55- TestMapContainer model1 = mapper .readValue (ordering1 , TestMapContainer .class );
57+ TestMapContainer3133 model1 = mapper .readValue (ordering1 , TestMapContainer3133 .class );
5658 Assertions .assertTrue (model1 .getMap ().get ("doubleValue" ) instanceof Double );
5759
5860 // case 2 : value first
5961 String ordering2 = a2q ("{'map': { 'doubleValue': 0.1 }, 'type': 'MAP'}" );
60- TestMapContainer model2 = mapper .readValue (ordering2 , TestMapContainer .class );
62+ TestMapContainer3133 model2 = mapper .readValue (ordering2 , TestMapContainer3133 .class );
6163 Assertions .assertTrue (model2 .getMap ().get ("doubleValue" ) instanceof Double );
6264 }
6365}
0 commit comments