Skip to content

Commit

Permalink
Mark #687 as fixed: most likely by a fix of fundamentally duplicate prob
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 16, 2017
1 parent 0cf9c07 commit a2bc7f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Expand Up @@ -18,6 +18,7 @@ Project: jackson-databind
#476: Allow "Serialize as POJO" using `@JsonFormat(shape=Shape.OBJECT)` class annotation #476: Allow "Serialize as POJO" using `@JsonFormat(shape=Shape.OBJECT)` class annotation
#507: Support for default `@JsonView` for a class #507: Support for default `@JsonView` for a class
(suggested by Mark W) (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` #865: `JsonFormat.Shape.OBJECT` ignored when class implements `Map.Entry`
#888: Allow specifying custom exclusion comparator via `@JsonInclude`, #888: Allow specifying custom exclusion comparator via `@JsonInclude`,
using `JsonInclude.Include.CUSTOM` using `JsonInclude.Include.CUSTOM`
Expand Down
@@ -1,13 +1,14 @@
package com.fasterxml.jackson.failing; package com.fasterxml.jackson.databind.objectid;


import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;


import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*; 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") @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="label")
static class ReferredWithCreator { static class ReferredWithCreator {
public String label; public String label;
Expand Down Expand Up @@ -63,7 +64,8 @@ static class EnclosingForRefWithNoCreator {
*/ */


private final ObjectMapper MAPPER = objectMapper(); private final ObjectMapper MAPPER = objectMapper();


// for [databind#687]
public void testSerializeDeserializeWithCreator() throws IOException { public void testSerializeDeserializeWithCreator() throws IOException {
ReferredWithCreator base = new ReferredWithCreator("label1"); ReferredWithCreator base = new ReferredWithCreator("label1");
ReferringToObjWithCreator r = new ReferringToObjWithCreator(); ReferringToObjWithCreator r = new ReferringToObjWithCreator();
Expand All @@ -72,10 +74,15 @@ public void testSerializeDeserializeWithCreator() throws IOException {
e.baseRef = base; e.baseRef = base;
e.nextRef = r; 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); // also, compare by re-serializing:
assertNotNull(deserialized); assertEquals(json, MAPPER.writeValueAsString(result));
} }


public void testSerializeDeserializeNoCreator() throws IOException { public void testSerializeDeserializeNoCreator() throws IOException {
Expand All @@ -86,9 +93,14 @@ public void testSerializeDeserializeNoCreator() throws IOException {
e.baseRef = base; e.baseRef = base;
e.nextRef = r; 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); // also, compare by re-serializing:
assertNotNull(deserialized); assertEquals(json, MAPPER.writeValueAsString(result));
} }
} }

0 comments on commit a2bc7f6

Please sign in to comment.