File tree 1 file changed +49
-0
lines changed
src/test/java/com/fasterxml/jackson/failing
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import java .beans .ConstructorProperties ;
4
+
5
+ import com .fasterxml .jackson .annotation .JsonIdentityInfo ;
6
+ import com .fasterxml .jackson .annotation .ObjectIdGenerators ;
7
+ import com .fasterxml .jackson .databind .*;
8
+
9
+ public class ObjectIdWithCreator1367Test
10
+ extends BaseMapTest
11
+ {
12
+ @ JsonIdentityInfo (generator = ObjectIdGenerators .PropertyGenerator .class , property = "id" )
13
+ // resolver = SimpleObjectIdResolver.class)
14
+ public static class A {
15
+ String id ;
16
+ String name ;
17
+
18
+ public A () { }
19
+
20
+ @ ConstructorProperties ({"id" , "name" })
21
+ public A (String id , String name ) {
22
+ this .id = id ;
23
+ this .name = name ;
24
+ }
25
+
26
+ public String getId () {
27
+ return id ;
28
+ }
29
+ public void setId (String id ) {
30
+ this .id = id ;
31
+ }
32
+ public String getName () {
33
+ return name ;
34
+ }
35
+ public void setName (String name ) {
36
+ this .name = name ;
37
+ }
38
+ }
39
+
40
+ public void testObjectIdWithCreator1367 () throws Exception
41
+ {
42
+ A a = new A ("123" , "A" );
43
+
44
+ ObjectMapper om = new ObjectMapper ();
45
+ String json = om .writeValueAsString (a );
46
+ A deser = om .readValue (json , A .class );
47
+ assertEquals (a .name , deser .name );
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments