-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b96a3b5
commit 4cfee07
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/test/java/com/fasterxml/jackson/failing/JsonIgnoreProperties1575Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class JsonIgnoreProperties1575Test extends BaseMapTest | ||
{ | ||
static class Person { | ||
public String name; | ||
|
||
@JsonProperty("person_z") // renaming this to person_p works | ||
@JsonIgnoreProperties({"person_z"}) // renaming this to person_p works | ||
// public Set<Person> personZ; | ||
public Person personZ; | ||
} | ||
|
||
public void testIgnorePropDeser1575() throws Exception | ||
{ | ||
String st = aposToQuotes("{ 'name': 'admin',\n" | ||
// + " 'person_z': [ { 'name': 'admin' } ]" | ||
+ " 'person_z': { 'name': 'admin' }" | ||
+ "}"); | ||
|
||
ObjectMapper mapper = new ObjectMapper(); | ||
Person result = mapper.readValue(st, Person.class); | ||
assertEquals("admin", result.name); | ||
} | ||
|
||
/* | ||
public void testIgnorePropSer1575() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper(); | ||
Person input = new Person(); | ||
input.name = "Bob"; | ||
// 24-Mar-2017, tatu: This shouldn't cause issues... but does as of now: | ||
// input.personZ = input; | ||
String json = mapper.writeValueAsString(input); | ||
assertNotNull(json); | ||
} | ||
*/ | ||
} |