Skip to content

Commit

Permalink
Merge branch '2.14' into 2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 18, 2023
2 parents 3168975 + c524e6b commit 4e1c9be
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.fasterxml.jackson.databind.records;

import com.fasterxml.jackson.annotation.JsonProperty;

import com.fasterxml.jackson.databind.*;

public class RecordFailingSetter3938Test extends BaseMapTest
Expand All @@ -19,8 +18,7 @@ default void setOptions(JsonNode value) {
}
}

public record Command3938(int id, String filter) implements NoOptionsCommand {
}
public record Command3938(int id, String filter) implements NoOptionsCommand { }

private final ObjectMapper MAPPER = newJsonMapper();

Expand All @@ -29,13 +27,13 @@ public void testFailingSetter3939() throws Exception
{
final ObjectReader R = MAPPER.readerFor(Command3938.class);

// First, missing value and `null` are fine
// First, missing value and `null` are fine, as long as we have all fields
assertNotNull(R.readValue(a2q("{'id':1, 'filter':'abc'}")));
assertNotNull(R.readValue(a2q("{'id':2, 'filter':'def', 'options':null}")));
assertNotNull(R.readValue(a2q("{'id':2, 'filter':'abc', 'options':null}")));

// But then failure for non-empty Array (f.ex)
try {
R.readValue(a2q("{'id':3, 'filter':'xyz', 'options':[ 123 ]}"));
R.readValue(a2q("{'id':2,'options':[123]}}"));
fail("Should not pass");
} catch (DatabindException e) {
verifyException(e, ERROR_3938_PREFIX);
Expand Down

0 comments on commit 4e1c9be

Please sign in to comment.