File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
src/test/java/com/fasterxml/jackson/failing Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .databind .BaseMapTest ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
+
6
+ public class EnumCreator1291Test extends BaseMapTest
7
+ {
8
+ static enum Enum1291 {
9
+
10
+ V1 ("val1" ),
11
+ V2 ("val2" ),
12
+ V3 ("val3" ),
13
+ V4 ("val4" ),
14
+ V5 ("val5" ),
15
+ V6 ("val6" );
16
+
17
+ private final String name ;
18
+
19
+ Enum1291 (String name ) {
20
+ this .name = name ;
21
+ }
22
+
23
+ public static Enum1291 fromString (String name ) {
24
+ for (Enum1291 type : Enum1291 .values ()) {
25
+ if (type .name .equals (name )) {
26
+ return type ;
27
+ }
28
+ }
29
+ return Enum1291 .valueOf (name .toUpperCase ());
30
+ }
31
+
32
+ @ Override
33
+ public String toString () {
34
+ return name ;
35
+ }
36
+ }
37
+
38
+ public void testEnumCreators1291 () throws Exception
39
+ {
40
+ ObjectMapper mapper = new ObjectMapper ();
41
+ String json = mapper .writeValueAsString (Enum1291 .V2 );
42
+ Enum1291 result = mapper .readValue (json , Enum1291 .class );
43
+ assertSame (Enum1291 .V2 , result );
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments