Skip to content

Commit c9f316b

Browse files
committed
add a (failing) test for #1367
1 parent 0cce1ca commit c9f316b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
}

0 commit comments

Comments
 (0)