-
-
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
c7184e0
commit b789144
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
src/test/java/com/fasterxml/jackson/failing/NullConversions2458Test.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 java.util.List; | ||
import java.util.Objects; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonSetter; | ||
import com.fasterxml.jackson.annotation.Nulls; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
public class NullConversions2458Test extends BaseMapTest | ||
{ | ||
static class Pojo { | ||
private final List<String> list; | ||
|
||
@JsonCreator | ||
public Pojo(@JsonProperty("list") List<String> list) { | ||
this.list = Objects.requireNonNull(list, "list"); | ||
} | ||
|
||
public List<String> getList() { | ||
return list; | ||
} | ||
} | ||
|
||
public void testNullsViaCreator() throws Exception { | ||
ObjectMapper mapper = newJsonMapper(); | ||
mapper.setDefaultSetterInfo(JsonSetter.Value.construct(Nulls.AS_EMPTY, | ||
Nulls.AS_EMPTY)); | ||
Pojo pojo = mapper.readValue("{}", Pojo.class); | ||
assertNotNull(pojo); | ||
} | ||
} |