Skip to content

Commit 4cfee07

Browse files
committed
Add a reproduction of #1575
1 parent b96a3b5 commit 4cfee07

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import com.fasterxml.jackson.databind.*;
7+
8+
public class JsonIgnoreProperties1575Test extends BaseMapTest
9+
{
10+
static class Person {
11+
public String name;
12+
13+
@JsonProperty("person_z") // renaming this to person_p works
14+
@JsonIgnoreProperties({"person_z"}) // renaming this to person_p works
15+
// public Set<Person> personZ;
16+
public Person personZ;
17+
}
18+
19+
public void testIgnorePropDeser1575() throws Exception
20+
{
21+
String st = aposToQuotes("{ 'name': 'admin',\n"
22+
// + " 'person_z': [ { 'name': 'admin' } ]"
23+
+ " 'person_z': { 'name': 'admin' }"
24+
+ "}");
25+
26+
ObjectMapper mapper = new ObjectMapper();
27+
Person result = mapper.readValue(st, Person.class);
28+
assertEquals("admin", result.name);
29+
}
30+
31+
/*
32+
public void testIgnorePropSer1575() throws Exception
33+
{
34+
ObjectMapper mapper = new ObjectMapper();
35+
Person input = new Person();
36+
input.name = "Bob";
37+
38+
// 24-Mar-2017, tatu: This shouldn't cause issues... but does as of now:
39+
40+
// input.personZ = input;
41+
String json = mapper.writeValueAsString(input);
42+
assertNotNull(json);
43+
}
44+
*/
45+
}

0 commit comments

Comments
 (0)