Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit 47793f0

Browse files
committed
Add a test for Optional; update release notes wrt #65
1 parent 489d8d6 commit 47793f0

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

release-notes/CREDITS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ Stephan Schroevers: (Stephan202@github)
1010

1111
* Contributed #56: Add support `HashCode`
1212
(2.5.0)
13+
* Contributed #65: Add deserialization support for SortedMultiset and ImmutableSortedMultiset
14+
(2.5.3)

release-notes/VERSION

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-datatype-guava
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.5.3 (not released yet)
8+
9+
#65: Add deserialization support for SortedMultiset and ImmutableSortedMultiset
10+
(contributed by Stephan S, Stephan202@github)
11+
712
2.5.2 (29-Mar-2015)
813

914
#62: Add `com.google.common.hash` to OSGi import list
@@ -16,7 +21,7 @@ No changes since 2.5.0
1621
2.5.0 (01-Jan-2015)
1722

1823
#56: Add support `HashCode`
19-
(contributed by Stephan202@github)
24+
(contributed by Stephan S, Stephan202@github)
2025

2126
2.4.6 (not yet released)
2227

src/test/java/com/fasterxml/jackson/datatype/guava/TestOptional.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,34 @@ public void testSerNonNull() throws Exception {
115115
String value = mapperWithModule().setSerializationInclusion(JsonInclude.Include.NON_NULL).writeValueAsString(data);
116116
assertEquals("{}", value);
117117
}
118+
119+
public void testSerOptDefault() throws Exception {
120+
OptionalData data = new OptionalData();
121+
data.myString = Optional.absent();
122+
String value = mapperWithModule().setSerializationInclusion(JsonInclude.Include.ALWAYS).writeValueAsString(data);
123+
assertEquals("{\"myString\":null}", value);
124+
}
118125

119126
public void testSerOptNull() throws Exception {
120127
OptionalData data = new OptionalData();
121128
data.myString = null;
122129
String value = mapperWithModule().setSerializationInclusion(JsonInclude.Include.NON_NULL).writeValueAsString(data);
123130
assertEquals("{}", value);
124131
}
132+
133+
public void testSerOptNonEmpty() throws Exception {
134+
OptionalData data = new OptionalData();
135+
data.myString = null;
136+
String value = mapperWithModule().setSerializationInclusion(JsonInclude.Include.NON_EMPTY).writeValueAsString(data);
137+
assertEquals("{}", value);
138+
}
139+
140+
public void testSerOptNonDefault() throws Exception {
141+
OptionalData data = new OptionalData();
142+
data.myString = null;
143+
String value = mapperWithModule().setSerializationInclusion(JsonInclude.Include.NON_DEFAULT).writeValueAsString(data);
144+
assertEquals("{}", value);
145+
}
125146

126147
public void testWithTypingEnabled() throws Exception
127148
{

0 commit comments

Comments
 (0)