Skip to content

Commit 9ad9d70

Browse files
committed
Update OptionWithBooleanDeserializerTest.scala
1 parent 6c690d1 commit 9ad9d70

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ class OptionWithBooleanDeserializerTest extends DeserializerTest with BeforeAndA
3838
useOptionBoolean(v1.valueBoolean) shouldBe "false"
3939
}
4040

41-
it should "support OptionBoolean" in {
41+
it should "support OptionBoolean (without registerReferencedType)" in {
42+
val v1 = deserialize("""{"valueBoolean":false}""", classOf[OptionBoolean])
43+
v1 shouldBe OptionBoolean(Some(false))
44+
v1.valueBoolean.get shouldBe false
45+
useOptionBoolean(v1.valueBoolean) shouldBe "false"
46+
}
47+
48+
it should "support OptionBoolean (with registerReferencedType)" in {
4249
ScalaAnnotationIntrospector.registerReferencedType(classOf[OptionBoolean], "valueBoolean", classOf[Boolean])
4350
val v1 = deserialize("""{"valueBoolean":false}""", classOf[OptionBoolean])
4451
v1 shouldBe OptionBoolean(Some(false))
4552
v1.valueBoolean.get shouldBe false
46-
//this will next call will fail with a Scala unboxing exception unless you ScalaAnnotationIntrospector.registerReferencedType
47-
//or use one of the equivalent classes in OptionWithBooleanDeserializerTest
4853
useOptionBoolean(v1.valueBoolean) shouldBe "false"
4954
}
5055

0 commit comments

Comments
 (0)