Skip to content

Commit ad17565

Browse files
committed
Update release notes wrt #19, minor cleanup
1 parent d450035 commit ad17565

File tree

3 files changed

+34
-24
lines changed

3 files changed

+34
-24
lines changed

jakarta-jsonp/src/test/java/com/fasterxml/jackson/datatype/jsonp/JsonValueDeserializationTest.java

+15-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010

1111
public class JsonValueDeserializationTest extends TestBase
1212
{
13+
static class ObjectImpl {
14+
JsonValue obj1;
15+
JsonValue obj2;
16+
17+
@ConstructorProperties({"obj1", "obj2"})
18+
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
19+
this.obj1 = obj1;
20+
this.obj2 = obj2;
21+
}
22+
}
23+
1324
private final ObjectMapper MAPPER = newMapper();
1425

1526
public void testSimpleArray() throws Exception
@@ -115,20 +126,12 @@ public void testNullNode() throws Exception
115126
// for [datatype-jsr353#19]
116127
public void testConstructorProperties() throws Exception
117128
{
118-
final String JSON = "{\"obj1\":{}}";
119-
ObjectImpl ob = MAPPER.readValue(JSON, ObjectImpl.class);
129+
ObjectImpl ob = MAPPER.readValue("{\"obj1\":{}}", ObjectImpl.class);
120130
assertTrue(ob.obj1 instanceof JsonObject);
121131
assertNull(ob.obj2);
122-
}
123-
124-
static class ObjectImpl {
125-
JsonValue obj1;
126-
JsonValue obj2;
127132

128-
@ConstructorProperties({"obj1", "obj2"})
129-
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
130-
this.obj1 = obj1;
131-
this.obj2 = obj2;
132-
}
133+
ObjectImpl ob2 = MAPPER.readValue("{\"obj2\":null}", ObjectImpl.class);
134+
assertNull(ob2.obj1);
135+
assertSame(JsonValue.NULL, ob2.obj2);
133136
}
134137
}

jsr-353/src/test/java/com/fasterxml/jackson/datatype/jsr353/JsonValueDeserializationTest.java

+16-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010

1111
public class JsonValueDeserializationTest extends TestBase
1212
{
13+
// for [datatype-jsr353#19]
14+
static class ObjectImpl {
15+
JsonValue obj1;
16+
JsonValue obj2;
17+
18+
@ConstructorProperties({"obj1", "obj2"})
19+
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
20+
this.obj1 = obj1;
21+
this.obj2 = obj2;
22+
}
23+
}
24+
1325
private final ObjectMapper MAPPER = newMapper();
1426

1527
public void testSimpleArray() throws Exception
@@ -115,20 +127,12 @@ public void testNullNode() throws Exception
115127
// for [datatype-jsr353#19]
116128
public void testConstructorProperties() throws Exception
117129
{
118-
final String JSON = "{\"obj1\":{}}";
119-
ObjectImpl ob = MAPPER.readValue(JSON, ObjectImpl.class);
130+
ObjectImpl ob = MAPPER.readValue("{\"obj1\":{}}", ObjectImpl.class);
120131
assertTrue(ob.obj1 instanceof JsonObject);
121132
assertNull(ob.obj2);
122-
}
123-
124-
static class ObjectImpl {
125-
JsonValue obj1;
126-
JsonValue obj2;
127133

128-
@ConstructorProperties({"obj1", "obj2"})
129-
public ObjectImpl(JsonValue obj1, JsonValue obj2) {
130-
this.obj1 = obj1;
131-
this.obj2 = obj2;
132-
}
134+
ObjectImpl ob2 = MAPPER.readValue("{\"obj2\":null}", ObjectImpl.class);
135+
assertNull(ob2.obj1);
136+
assertSame(JsonValue.NULL, ob2.obj2);
133137
}
134138
}

release-notes/VERSION-2.x

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Modules:
1414

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

1821
2.13.2 (06-Mar-2022)
1922
2.13.1 (19-Dec-2021)

0 commit comments

Comments
 (0)