From 4cfee0756cecfb62af04c92b4c88edd13df7b9de Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 24 Mar 2017 17:07:07 -0700 Subject: [PATCH] Add a reproduction of #1575 --- .../failing/JsonIgnoreProperties1575Test.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/test/java/com/fasterxml/jackson/failing/JsonIgnoreProperties1575Test.java diff --git a/src/test/java/com/fasterxml/jackson/failing/JsonIgnoreProperties1575Test.java b/src/test/java/com/fasterxml/jackson/failing/JsonIgnoreProperties1575Test.java new file mode 100644 index 0000000000..3df41bc710 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/failing/JsonIgnoreProperties1575Test.java @@ -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 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); + } + */ +}