-
-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3bc9a0a
commit 73d3bbd
Showing
3 changed files
with
144 additions
and
7 deletions.
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
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
63 changes: 63 additions & 0 deletions
63
...t/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForContent4200Test.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,63 @@ | ||
package com.fasterxml.jackson.databind.deser.filter; | ||
|
||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
import com.fasterxml.jackson.databind.exc.InvalidNullException; | ||
|
||
// [databind#4200]: Nulls.FAIL not taken into account with DELEGATING creator | ||
public class NullConversionsForContent4200Test extends BaseMapTest | ||
{ | ||
static class DelegatingWrapper4200 { | ||
private final Map<String, String> value; | ||
|
||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING) | ||
DelegatingWrapper4200(@JsonSetter(contentNulls = Nulls.FAIL) | ||
Map<String, String> value) | ||
{ | ||
this.value = value; | ||
} | ||
|
||
public Map<String, String> getValue() { | ||
return value; | ||
} | ||
} | ||
|
||
static class SetterWrapper4200 { | ||
private Map<String, String> value; | ||
|
||
public Map<String, String> getValue() { | ||
return value; | ||
} | ||
|
||
@JsonSetter(contentNulls = Nulls.FAIL) | ||
public void setValue(Map<String, String> value) { | ||
this.value = value; | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
public void testDelegatingCreatorNulls4200() throws Exception | ||
{ | ||
try { | ||
MAPPER.readValue(a2q("{'foo': null}"), DelegatingWrapper4200.class); | ||
fail("Should not pass"); | ||
} catch (InvalidNullException e) { | ||
verifyException(e, "Invalid `null` value"); | ||
} | ||
} | ||
|
||
public void testSetterNulls4200() throws Exception | ||
{ | ||
try { | ||
MAPPER.readValue(a2q("{'value':{'foo': null}}"), | ||
SetterWrapper4200.class); | ||
fail("Should not pass"); | ||
} catch (InvalidNullException e) { | ||
verifyException(e, "Invalid `null` value"); | ||
} | ||
} | ||
} |