diff --git a/release-notes/VERSION b/release-notes/VERSION index 19f1beabe3..7c329d4ace 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -18,6 +18,7 @@ Project: jackson-databind #476: Allow "Serialize as POJO" using `@JsonFormat(shape=Shape.OBJECT)` class annotation #507: Support for default `@JsonView` for a class (suggested by Mark W) +#687: Exception deserializing a collection @JsonIdentityInfo and a property based creator #865: `JsonFormat.Shape.OBJECT` ignored when class implements `Map.Entry` #888: Allow specifying custom exclusion comparator via `@JsonInclude`, using `JsonInclude.Include.CUSTOM` diff --git a/src/test/java/com/fasterxml/jackson/failing/TestObjectId687.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java similarity index 76% rename from src/test/java/com/fasterxml/jackson/failing/TestObjectId687.java rename to src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java index fd8fabc6dd..972a5fa8f9 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestObjectId687.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java @@ -1,4 +1,4 @@ -package com.fasterxml.jackson.failing; +package com.fasterxml.jackson.databind.objectid; import java.io.IOException; import java.util.*; @@ -6,8 +6,9 @@ import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; -public class TestObjectId687 extends BaseMapTest +public class ObjectId687Test extends BaseMapTest { + // for [databind#687] @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="label") static class ReferredWithCreator { public String label; @@ -63,7 +64,8 @@ static class EnclosingForRefWithNoCreator { */ private final ObjectMapper MAPPER = objectMapper(); - + + // for [databind#687] public void testSerializeDeserializeWithCreator() throws IOException { ReferredWithCreator base = new ReferredWithCreator("label1"); ReferringToObjWithCreator r = new ReferringToObjWithCreator(); @@ -72,10 +74,15 @@ public void testSerializeDeserializeWithCreator() throws IOException { e.baseRef = base; e.nextRef = r; - String jsonStr = MAPPER.writeValueAsString(e); + String json = MAPPER.writeValueAsString(e); + + EnclosingForRefsWithCreator result = MAPPER.readValue(json, + EnclosingForRefsWithCreator.class); + assertNotNull(result); + assertEquals(result.label, e.label); - EnclosingForRefsWithCreator deserialized = MAPPER.readValue(jsonStr, EnclosingForRefsWithCreator.class); - assertNotNull(deserialized); + // also, compare by re-serializing: + assertEquals(json, MAPPER.writeValueAsString(result)); } public void testSerializeDeserializeNoCreator() throws IOException { @@ -86,9 +93,14 @@ public void testSerializeDeserializeNoCreator() throws IOException { e.baseRef = base; e.nextRef = r; - String jsonStr = MAPPER.writeValueAsString(e); + String json = MAPPER.writeValueAsString(e); + + EnclosingForRefWithNoCreator result = MAPPER.readValue(json, + EnclosingForRefWithNoCreator.class); + assertNotNull(result); + assertEquals(result.label, e.label); - EnclosingForRefWithNoCreator deserialized = MAPPER.readValue(jsonStr, EnclosingForRefWithNoCreator.class); - assertNotNull(deserialized); + // also, compare by re-serializing: + assertEquals(json, MAPPER.writeValueAsString(result)); } }