File tree 2 files changed +39
-2
lines changed
main/java/com/fasterxml/jackson/databind/ser/std
test/java/com/fasterxml/jackson/failing
2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .databind .ser .std ;
2
2
3
3
import java .io .IOException ;
4
- import java .lang .reflect .Type ;
5
4
import java .text .DateFormat ;
6
5
7
6
import com .fasterxml .jackson .core .JsonGenerator ;
8
7
9
8
import com .fasterxml .jackson .databind .*;
10
9
import com .fasterxml .jackson .databind .annotation .JacksonStdImpl ;
11
- import com .fasterxml .jackson .databind .jsonFormatVisitors .JsonFormatVisitorWrapper ;
12
10
13
11
/**
14
12
* Compared to regular {@link java.util.Date} serialization, we do use String
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonAutoDetect ;
4
+ import com .fasterxml .jackson .annotation .JsonCreator ;
5
+ import com .fasterxml .jackson .annotation .PropertyAccessor ;
6
+
7
+ import com .fasterxml .jackson .databind .*;
8
+
9
+ // Should be failing but isn't... keeping here for a bit, until underlying
10
+ // problem is resolved (was active 21-Jul-2017)
11
+ public class EnumCreator1699Test extends BaseMapTest
12
+ {
13
+ enum JacksonTest {
14
+ TEST1 (0 ), TEST2 (1 );
15
+
16
+ private JacksonTest (int i ) { }
17
+
18
+ @ JsonCreator
19
+ public static JacksonTest fromInt (int i ) {
20
+ switch (i ) {
21
+ case 1 : return TEST1 ;
22
+ case 2 : return TEST2 ;
23
+ default : throw new IllegalArgumentException ();
24
+ }
25
+ }
26
+ }
27
+
28
+ public void testIssue1699 () throws Exception
29
+ {
30
+ final ObjectMapper mapper = new ObjectMapper ();
31
+
32
+ mapper .setVisibility (PropertyAccessor .ALL , JsonAutoDetect .Visibility .NONE );
33
+ mapper .setVisibility (PropertyAccessor .FIELD , JsonAutoDetect .Visibility .ANY );
34
+ mapper .setVisibility (PropertyAccessor .CREATOR , JsonAutoDetect .Visibility .ANY );
35
+
36
+ JacksonTest result = mapper .readValue ("1" , JacksonTest .class );
37
+ assertEquals (JacksonTest .TEST1 , result );
38
+ }
39
+ }
You can’t perform that action at this time.
0 commit comments