Skip to content

Commit 5df4f3e

Browse files
committed
Fix unit tests wrt change to DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES default
1 parent 92ebd8b commit 5df4f3e

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/AnySetterTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ public void testSimpleMapImitation() throws Exception
218218
public void testAnySetterDisable() throws Exception
219219
{
220220
try {
221-
MAPPER.readValue(cborDoc(aposToQuotes("{'value':3}")),
222-
MapImitatorDisabled.class);
221+
MAPPER.readerFor(MapImitatorDisabled.class)
222+
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
223+
.readValue(cborDoc(aposToQuotes("{'value':3}")));
223224
fail("Should not pass");
224225
} catch (UnrecognizedPropertyException e) {
225226
verifyException(e, "Unrecognized property \"value\"");

cbor/src/test/java/tools/jackson/dataformat/cbor/mapper/CaseInsensitiveDeserTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public void testCaseInsensitiveDeserialization() throws Exception
5353
ObjectMapper mapper = sharedMapper();
5454
assertFalse(mapper.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
5555
try {
56-
mapper.readValue(DOC, Issue476Bean.class);
56+
mapper.readerFor(Issue476Bean.class)
57+
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
58+
.readValue(DOC);
5759
fail("Should not accept improper case properties by default");
5860
} catch (UnrecognizedPropertyException e) {
5961
verifyException(e, "Unrecognized property ");

smile/src/test/java/tools/jackson/dataformat/smile/mapper/AnySetterTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ public void testSimpleMapImitation() throws Exception
218218
public void testAnySetterDisable() throws Exception
219219
{
220220
try {
221-
MAPPER.readValue(_smileDoc(aposToQuotes("{'value':3}")),
222-
MapImitatorDisabled.class);
221+
MAPPER.readerFor(MapImitatorDisabled.class)
222+
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
223+
.readValue(_smileDoc(aposToQuotes("{'value':3}")));
223224
fail("Should not pass");
224225
} catch (UnrecognizedPropertyException e) {
225226
verifyException(e, "Unrecognized property \"value\"");

smile/src/test/java/tools/jackson/dataformat/smile/mapper/CaseInsensitiveDeserTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public void testCaseInsensitiveDeserialization() throws Exception
5353
ObjectMapper mapper = newSmileMapper();
5454
assertFalse(mapper.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
5555
try {
56-
mapper.readValue(DOC, Issue476Bean.class);
56+
mapper.readerFor(Issue476Bean.class)
57+
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
58+
.readValue(DOC);
5759
fail("Should not accept improper case properties by default");
5860
} catch (UnrecognizedPropertyException e) {
5961
verifyException(e, "Unrecognized property ");

0 commit comments

Comments
 (0)