-
-
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
Showing
3 changed files
with
45 additions
and
2 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
35 changes: 35 additions & 0 deletions
35
src/test/java/tools/jackson/databind/ser/filter/JsonInclude4741Test.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 tools.jackson.databind.ser.filter; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import tools.jackson.databind.ObjectMapper; | ||
import tools.jackson.databind.testutil.DatabindTestUtil; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class JsonInclude4741Test | ||
extends DatabindTestUtil | ||
{ | ||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
public static class MyString { | ||
public String value = null; | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
@Test | ||
void testSerialization() throws Exception | ||
{ | ||
MyString input = new MyString(); | ||
input.value = ""; | ||
|
||
String json = MAPPER.writeValueAsString(input); | ||
assertEquals(a2q("{'value':''}"), json); | ||
|
||
MyString output = MAPPER.readValue(json, MyString.class); | ||
|
||
assertEquals(input.value, output.value); | ||
} | ||
} |