Skip to content

Commit

Permalink
Update release notes wrt #19, minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 9, 2022
1 parent d450035 commit ad17565
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@

public class JsonValueDeserializationTest extends TestBase
{
static class ObjectImpl {
JsonValue obj1;
JsonValue obj2;

@ConstructorProperties({"obj1", "obj2"})
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
this.obj1 = obj1;
this.obj2 = obj2;
}
}

private final ObjectMapper MAPPER = newMapper();

public void testSimpleArray() throws Exception
Expand Down Expand Up @@ -115,20 +126,12 @@ public void testNullNode() throws Exception
// for [datatype-jsr353#19]
public void testConstructorProperties() throws Exception
{
final String JSON = "{\"obj1\":{}}";
ObjectImpl ob = MAPPER.readValue(JSON, ObjectImpl.class);
ObjectImpl ob = MAPPER.readValue("{\"obj1\":{}}", ObjectImpl.class);
assertTrue(ob.obj1 instanceof JsonObject);
assertNull(ob.obj2);
}

static class ObjectImpl {
JsonValue obj1;
JsonValue obj2;

@ConstructorProperties({"obj1", "obj2"})
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
this.obj1 = obj1;
this.obj2 = obj2;
}
ObjectImpl ob2 = MAPPER.readValue("{\"obj2\":null}", ObjectImpl.class);
assertNull(ob2.obj1);
assertSame(JsonValue.NULL, ob2.obj2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@

public class JsonValueDeserializationTest extends TestBase
{
// for [datatype-jsr353#19]
static class ObjectImpl {
JsonValue obj1;
JsonValue obj2;

@ConstructorProperties({"obj1", "obj2"})
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
this.obj1 = obj1;
this.obj2 = obj2;
}
}

private final ObjectMapper MAPPER = newMapper();

public void testSimpleArray() throws Exception
Expand Down Expand Up @@ -115,20 +127,12 @@ public void testNullNode() throws Exception
// for [datatype-jsr353#19]
public void testConstructorProperties() throws Exception
{
final String JSON = "{\"obj1\":{}}";
ObjectImpl ob = MAPPER.readValue(JSON, ObjectImpl.class);
ObjectImpl ob = MAPPER.readValue("{\"obj1\":{}}", ObjectImpl.class);
assertTrue(ob.obj1 instanceof JsonObject);
assertNull(ob.obj2);
}

static class ObjectImpl {
JsonValue obj1;
JsonValue obj2;

@ConstructorProperties({"obj1", "obj2"})
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
this.obj1 = obj1;
this.obj2 = obj2;
}
ObjectImpl ob2 = MAPPER.readValue("{\"obj2\":null}", ObjectImpl.class);
assertNull(ob2.obj1);
assertSame(JsonValue.NULL, ob2.obj2);
}
}
3 changes: 3 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Modules:

#17: Add configurable amount representations for Joda Money module
(contributed by Andrzej P)
#19: `JsonValue.NULL` deserialization has different behaviours with constructor properties
vs public properties
(contributed by xdrsynapse@github)

2.13.2 (06-Mar-2022)
2.13.1 (19-Dec-2021)
Expand Down

0 comments on commit ad17565

Please sign in to comment.