Skip to content

Commit

Permalink
Add a reproduction of #1575
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 25, 2017
1 parent b96a3b5 commit 4cfee07
Showing 1 changed file with 45 additions and 0 deletions.
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);
}
*/
}

0 comments on commit 4cfee07

Please sign in to comment.