Skip to content

Commit

Permalink
Consistent stack traces for failing tests in Databind.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjust committed Sep 9, 2024
1 parent d1d0879 commit cdb80e5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestExceptionDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestExceptionDeserialization.java
index 391ee8386..ab2f03415 100644
--- a/src/test/java/com/fasterxml/jackson/databind/deser/TestExceptionDeserialization.java
+++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestExceptionDeserialization.java
@@ -51,7 +51,7 @@ public class TestExceptionDeserialization
/**********************************************************
*/

- final ObjectMapper MAPPER = new ObjectMapper();
+ final ObjectMapper MAPPER = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

public void testIOException() throws IOException
{
@@ -78,6 +78,7 @@ public class TestExceptionDeserialization
public void testWithNullMessage() throws IOException
{
final ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String json = mapper.writeValueAsString(new IOException((String) null));
IOException result = mapper.readValue(json, IOException.class);
@@ -101,6 +101,7 @@ public class TestExceptionDeserialization
// [databind#381]
public void testSingleValueArrayDeserialization() throws Exception {
final ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS);
final IOException exp;
try {
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ index 255bffe38..51d980959 100644
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String json = mapper.writeValueAsString(new IOException((String) null));
IOException result = mapper.readValue(json, IOException.class);
@@ -100,6 +100,7 @@ public class TestExceptionDeserialization
// [Issue#381]
@@ -99,6 +99,7 @@ public class TestExceptionDeserialization
// [databind#381]
public void testSingleValueArrayDeserialization() throws Exception {
final ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ index 43084c960..a7850ba51 100644
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String json = mapper.writeValueAsString(new IOException((String) null));
IOException result = mapper.readValue(json, IOException.class);
@@ -100,6 +100,7 @@ public class TestExceptionDeserialization
// [Issue#381]
@@ -99,6 +99,7 @@ public class TestExceptionDeserialization
// [databind#381]
public void testSingleValueArrayDeserialization() throws Exception {
final ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Expand Down

0 comments on commit cdb80e5

Please sign in to comment.