Skip to content

Run tests in non-strict JSON mode, like real applications #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void testLookAhead() {
// Unknown field 'baz' (JSON path: properties['foo-bar'].baz) (...line no=1, column no=36, offset=35)

JsonpMappingException e = assertThrows(JsonpMappingException.class, () -> {
fromJson(json, TypeMapping.class);
fromJson(json, TypeMapping.class, SimpleJsonpMapper.INSTANCE_REJECT_UNKNOWN_FIELDS);
});

// Check escaping of non identifier path elements and path from map elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,15 @@ private static JsonpMapper createMapper(JsonImpl jsonImpl, int rand) {
switch(jsonImpl) {
case Jsonb:
System.out.println("Using a JsonB mapper (rand = " + rand + ").");
return new JsonbJsonpMapper() {
@Override
public boolean ignoreUnknownFields() {
return false;
}
};
return new JsonbJsonpMapper();

case Jackson:
System.out.println("Using a Jackson mapper (rand = " + rand + ").");
return new JacksonJsonpMapper() {
@Override
public boolean ignoreUnknownFields() {
return false;
}
};
return new JacksonJsonpMapper();

default:
System.out.println("Using a simple mapper (rand = " + rand + ").");
return SimpleJsonpMapper.INSTANCE_REJECT_UNKNOWN_FIELDS;
return SimpleJsonpMapper.INSTANCE;
}
}

Expand Down
Loading