File tree 2 files changed +51
-1
lines changed
src/test/java/com/fasterxml/jackson
2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ enum MixinOverloadedDefault {
90
90
/* Test methods
91
91
/**********************************************************
92
92
*/
93
- private final ObjectMapper MAPPER = new ObjectMapper ();
93
+
94
+ private final ObjectMapper MAPPER = newJsonMapper ();
94
95
95
96
@ Test
96
97
public void testWithoutCustomFeatures () throws Exception
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+
5
+ import com .fasterxml .jackson .annotation .JsonEnumDefaultValue ;
6
+ import com .fasterxml .jackson .annotation .JsonProperty ;
7
+
8
+ import com .fasterxml .jackson .databind .DeserializationFeature ;
9
+ import com .fasterxml .jackson .databind .ObjectMapper ;
10
+ import com .fasterxml .jackson .databind .ObjectReader ;
11
+
12
+ import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .newJsonMapper ;
13
+ import static com .fasterxml .jackson .databind .testutil .DatabindTestUtil .q ;
14
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
15
+
16
+ public class EnumDefaultRead4403Test
17
+ {
18
+ // [databind#4403]
19
+ enum Brand4403 {
20
+ @ JsonProperty ("005" )
21
+ SEAT ,
22
+
23
+ @ JsonProperty ("006" )
24
+ HYUNDAI ,
25
+ @ JsonEnumDefaultValue
26
+ OTHER
27
+ }
28
+
29
+ /*
30
+ /**********************************************************
31
+ /* Test methods
32
+ /**********************************************************
33
+ */
34
+
35
+ private final ObjectMapper MAPPER = newJsonMapper ();
36
+
37
+ // [databind#4403]
38
+ @ Test
39
+ public void readFromDefault4403 () throws Exception
40
+ {
41
+ ObjectReader r = MAPPER .readerFor (Brand4403 .class )
42
+ .with (DeserializationFeature .READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE );
43
+ assertEquals (Brand4403 .SEAT , r .readValue (q ("005" )));
44
+ assertEquals (Brand4403 .HYUNDAI , r .readValue (q ("006" )));
45
+ assertEquals (Brand4403 .OTHER , r .readValue (q ("x" )));
46
+ assertEquals (Brand4403 .OTHER , r .readValue (q ("001" )));
47
+ }
48
+
49
+ }
You can’t perform that action at this time.
0 commit comments