From c524e6b6370ca5417b0fbe691fc98bfc4397c17f Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 18 May 2023 15:53:45 -0700 Subject: [PATCH] Fix #3938 to repro actual issue --- .../databind/records/RecordFailingSetter3938Test.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordFailingSetter3938Test.java b/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordFailingSetter3938Test.java index 8e263c5dae..3fe8cfef18 100644 --- a/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordFailingSetter3938Test.java +++ b/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordFailingSetter3938Test.java @@ -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 @@ -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(); @@ -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);