File tree 1 file changed +45
-0
lines changed
src/test/java/com/fasterxml/jackson/failing
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 .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
+ }
You can’t perform that action at this time.
0 commit comments