forked from FasterXML/jackson-databind
-
Notifications
You must be signed in to change notification settings - Fork 0
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
e87a739
commit 92223fe
Showing
5 changed files
with
132 additions
and
41 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
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
25 changes: 25 additions & 0 deletions
25
src/test/java/com/fasterxml/jackson/failing/OptionalnclusionTest.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,25 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.util.Optional; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; | ||
|
||
import com.fasterxml.jackson.datatype.jdk8.ModuleTestBase; | ||
|
||
public class OptionalnclusionTest extends ModuleTestBase | ||
{ | ||
@JsonAutoDetect(fieldVisibility=Visibility.ANY) | ||
public static final class OptionalData { | ||
public Optional<String> myString = Optional.empty(); | ||
} | ||
|
||
public void testSerOptNonDefault() throws Exception | ||
{ | ||
OptionalData data = new OptionalData(); | ||
data.myString = null; | ||
String value = mapperWithModule().setSerializationInclusion( | ||
JsonInclude.Include.NON_DEFAULT).writeValueAsString(data); | ||
assertEquals("{}", value); | ||
} | ||
} |