Skip to content

Commit

Permalink
fix tests (#663)
Browse files Browse the repository at this point in the history
  • Loading branch information
JooHyukKim authored Jul 25, 2024
1 parent 642101d commit 480f207
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public void testCaseInsensitiveBasic() throws Exception

// but not without
try {
MAPPER.readValue(DOC, BaseResponse.class);
MAPPER.readerFor(BaseResponse.class)
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.readValue(DOC);
fail("Should not pass");
} catch (UnrecognizedPropertyException e) {
verifyException(e, "ErrorCode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ public void testSimpleWithIgnores() throws Exception
Object o = null;

try {
o = MAPPER.readValue(doc, ValueClassXY.class);
o = MAPPER.readerFor(ValueClassXY.class)
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.readValue(doc);
fail("Should not pass");
} catch (UnrecognizedPropertyException e) {
assertEquals("z", e.getPropertyName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import tools.jackson.databind.DeserializationFeature;
import tools.jackson.databind.exc.MismatchedInputException;
import tools.jackson.dataformat.xml.XmlMapper;
import tools.jackson.dataformat.xml.XmlTestBase;
Expand Down Expand Up @@ -136,7 +137,9 @@ public void testAlternateTextElementName() throws IOException
final String XML = "<JAXBStyle>foo</JAXBStyle>";
// first: verify that without change, POJO would not match:
try {
MAPPER.readValue(XML, JAXBStyle.class);
MAPPER.readerFor(JAXBStyle.class)
.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.readValue(XML);
fail("Should have failed");
} catch (MismatchedInputException e) {
// verifyException(e, "Cannot construct instance of");
Expand Down

0 comments on commit 480f207

Please sign in to comment.