Skip to content

Commit ef38891

Browse files
committed
Add a failing test for #3214
1 parent 9019677 commit ef38891

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)