Skip to content

Commit c889d3f

Browse files
committed
Optional JsonInclude.NON_NULL actually prints null on empty values.
See https://github.com/FasterXML/jackson-datatype-jdk8/issues/1 for more information.
1 parent 4e54123 commit c889d3f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/scala/com/fasterxml/jackson/module/scala/ser/OptionSerializerTest.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ class OptionSerializerTest extends SerializerTest {
9090
}
9191

9292
it should "honor JsonInclude.Include.NON_NULL" in {
93-
val nonNullMapper = newMapper
94-
nonNullMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
95-
nonNullMapper.writeValueAsString(new NonNullOption()) should be ("{}")
93+
// See https://github.com/FasterXML/jackson-datatype-jdk8/issues/1 for more information.
94+
newMapper
95+
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
96+
.writeValueAsString(new NonNullOption()) should be ("""{"foo":null}""")
9697
}
9798

9899
it should "generate correct schema for options" in {

0 commit comments

Comments
 (0)