Skip to content

Commit 36c7656

Browse files
committed
add test
1 parent fdfb9be commit 36c7656

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/test/scala/com/fasterxml/jackson/module/scala/deser/CaseClassDeserializerTest.scala

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package deser
55
import com.fasterxml.jackson.annotation.JsonProperty
66
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
77
import com.fasterxml.jackson.databind.{JsonMappingException, ObjectMapper, ObjectReader, PropertyNamingStrategy}
8-
import com.fasterxml.jackson.module.scala.ser.ClassWithUnitField
8+
import com.fasterxml.jackson.module.scala.ser.{ClassWithOnlyUnitField, ClassWithUnitField}
99

1010
import java.time.LocalDateTime
1111

@@ -168,4 +168,11 @@ class CaseClassDeserializerTest extends DeserializerTest {
168168
val result = deserialize(input, classOf[ClassWithUnitField])
169169
result shouldEqual ClassWithUnitField((), 2)
170170
}
171+
172+
//this does not currently work
173+
it should "support ClassWithOnlyUnitField" ignore {
174+
val input = """{}"""
175+
val result = deserialize(input, classOf[ClassWithOnlyUnitField])
176+
result shouldEqual ClassWithOnlyUnitField(())
177+
}
171178
}

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

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ case class PrivateDefaultFields(
6060
)
6161

6262
case class ClassWithUnitField(field: Unit, intField: Int)
63+
case class ClassWithOnlyUnitField(field: Unit)
6364

6465
class CaseClassSerializerTest extends SerializerTest {
6566

@@ -193,4 +194,8 @@ class CaseClassSerializerTest extends SerializerTest {
193194
it should "serialize ClassWithUnitField" in {
194195
serialize(ClassWithUnitField((), 2)) shouldEqual """{"intField":2}"""
195196
}
197+
198+
it should "serialize ClassWithOnlyUnitField" in {
199+
serialize(ClassWithOnlyUnitField(())) shouldEqual """{}"""
200+
}
196201
}

0 commit comments

Comments
 (0)