-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9019677
commit ef38891
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/test/java/com/fasterxml/jackson/failing/NullJsonNodeViaCreator3214Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.*; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
|
||
public class NullJsonNodeViaCreator3214Test extends BaseMapTest | ||
{ | ||
static class Pojo3214 | ||
{ | ||
JsonNode fromCtor = TextNode.valueOf("x"); | ||
JsonNode fromSetter = TextNode.valueOf("x"); | ||
|
||
@JsonCreator | ||
public Pojo3214(@JsonProperty("node") JsonNode n) { | ||
this.fromCtor = n; | ||
} | ||
|
||
public void setNodeFromSetter(JsonNode nodeFromSetter) { | ||
this.fromSetter = nodeFromSetter; | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
// [databind#3214] | ||
public void testNullFromMissingNodeParameter() throws Exception | ||
{ | ||
Pojo3214 p = MAPPER.readValue("{}", Pojo3214.class); | ||
if (p.fromCtor != null) { | ||
fail("Expected null to be passed, got instance of "+p.fromCtor.getClass()); | ||
} | ||
} | ||
} |