1
1
package com .fasterxml .jackson .databind .records ;
2
2
3
3
import com .fasterxml .jackson .annotation .JsonProperty ;
4
-
5
4
import com .fasterxml .jackson .databind .*;
6
5
7
6
public class RecordFailingSetter3938Test extends BaseMapTest
@@ -19,8 +18,7 @@ default void setOptions(JsonNode value) {
19
18
}
20
19
}
21
20
22
- public record Command3938 (int id , String filter ) implements NoOptionsCommand {
23
- }
21
+ public record Command3938 (int id , String filter ) implements NoOptionsCommand { }
24
22
25
23
private final ObjectMapper MAPPER = newJsonMapper ();
26
24
@@ -29,13 +27,13 @@ public void testFailingSetter3939() throws Exception
29
27
{
30
28
final ObjectReader R = MAPPER .readerFor (Command3938 .class );
31
29
32
- // First, missing value and `null` are fine
30
+ // First, missing value and `null` are fine, as long as we have all fields
33
31
assertNotNull (R .readValue (a2q ("{'id':1, 'filter':'abc'}" )));
34
- assertNotNull (R .readValue (a2q ("{'id':2, 'filter':'def ', 'options':null}" )));
32
+ assertNotNull (R .readValue (a2q ("{'id':2, 'filter':'abc ', 'options':null}" )));
35
33
36
34
// But then failure for non-empty Array (f.ex)
37
35
try {
38
- R .readValue (a2q ("{'id':3, 'filter':'xyz', ' options':[ 123 ] }" ));
36
+ R .readValue (a2q ("{'id':2,' options':[123]} }" ));
39
37
fail ("Should not pass" );
40
38
} catch (DatabindException e ) {
41
39
verifyException (e , ERROR_3938_PREFIX );
0 commit comments