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 ;
2
5
3
6
import java .util .HashMap ;
4
7
import java .util .Map ;
10
13
import org .junit .jupiter .api .Assertions ;
11
14
import org .junit .jupiter .api .Test ;
12
15
13
- import static com .fasterxml .jackson .databind .BaseMapTest .jsonMapperBuilder ;
14
- import static com .fasterxml .jackson .databind .BaseTest .a2q ;
15
-
16
16
/**
17
17
* Unit test proving that below issue is fixed.
18
18
* <p>
@@ -27,11 +27,11 @@ public class BigDecimalForFloatDisabled3133Test
27
27
property = "type" )
28
28
29
29
@ JsonSubTypes ({
30
- @ JsonSubTypes .Type (value = TestMapContainer .class , name = "MAP" ),
30
+ @ JsonSubTypes .Type (value = TestMapContainer3133 .class , name = "MAP" ),
31
31
})
32
- interface TestJsonTypeInfoInterface { }
32
+ interface BaseType3133 { }
33
33
34
- static class TestMapContainer implements TestJsonTypeInfoInterface {
34
+ static class TestMapContainer3133 implements BaseType3133 {
35
35
36
36
private Map <String , ? extends Object > map = new HashMap <>();
37
37
@@ -48,16 +48,18 @@ public void setMap(Map<String, ? extends Object> map) {
48
48
.disable (DeserializationFeature .USE_BIG_DECIMAL_FOR_FLOATS )
49
49
.build ();
50
50
51
+ // [databind#3133]
51
52
@ Test
52
- public void testDeserializeWithDifferentOrdering () throws Exception {
53
+ public void testDeserializeWithDifferentOrdering3133 () throws Exception
54
+ {
53
55
// case 1 : type first
54
56
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 );
56
58
Assertions .assertTrue (model1 .getMap ().get ("doubleValue" ) instanceof Double );
57
59
58
60
// case 2 : value first
59
61
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 );
61
63
Assertions .assertTrue (model2 .getMap ().get ("doubleValue" ) instanceof Double );
62
64
}
63
65
}
0 commit comments