File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/test/java/com/fasterxml/jackson/failing Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .failing ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonCreator ;
4
+ import com .fasterxml .jackson .annotation .JsonProperty ;
5
+ import com .fasterxml .jackson .databind .*;
6
+ import com .fasterxml .jackson .databind .node .TextNode ;
7
+
8
+ public class NullJsonNodeViaCreator3214Test extends BaseMapTest
9
+ {
10
+ static class Pojo3214
11
+ {
12
+ JsonNode fromCtor = TextNode .valueOf ("x" );
13
+ JsonNode fromSetter = TextNode .valueOf ("x" );
14
+
15
+ @ JsonCreator
16
+ public Pojo3214 (@ JsonProperty ("node" ) JsonNode n ) {
17
+ this .fromCtor = n ;
18
+ }
19
+
20
+ public void setNodeFromSetter (JsonNode nodeFromSetter ) {
21
+ this .fromSetter = nodeFromSetter ;
22
+ }
23
+ }
24
+
25
+ private final ObjectMapper MAPPER = newJsonMapper ();
26
+
27
+ // [databind#3214]
28
+ public void testNullFromMissingNodeParameter () throws Exception
29
+ {
30
+ Pojo3214 p = MAPPER .readValue ("{}" , Pojo3214 .class );
31
+ if (p .fromCtor != null ) {
32
+ fail ("Expected null to be passed, got instance of " +p .fromCtor .getClass ());
33
+ }
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments