From fad1abaa5b422cee18295294cb4332dd51c49ad5 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sun, 8 Oct 2023 11:17:00 +0100 Subject: [PATCH] more tests --- .../module/scala/deser/IntMapDeserializerTest.scala | 11 +++++++++++ .../module/scala/deser/IterableDeserializerTest.scala | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/test/scala/com/fasterxml/jackson/module/scala/deser/IntMapDeserializerTest.scala b/src/test/scala/com/fasterxml/jackson/module/scala/deser/IntMapDeserializerTest.scala index 172c30a1b..785be762c 100644 --- a/src/test/scala/com/fasterxml/jackson/module/scala/deser/IntMapDeserializerTest.scala +++ b/src/test/scala/com/fasterxml/jackson/module/scala/deser/IntMapDeserializerTest.scala @@ -88,6 +88,17 @@ class IntMapDeserializerTest extends DeserializerTest { read(2) shouldEqual Map("id" -> event.id.toString, "description" -> event.description) } + it should "deserialize IntMap[_]" in { + val event = Event(UUID.randomUUID(), "event1") + val map = IntMap(0 -> false, 1 -> "true", 2 -> event) + val mapper = newMapper + val json = mapper.writeValueAsString(map) + val read = mapper.readValue(json, new TypeReference[IntMap[_]]{}) + read(0) shouldBe false + read(1) shouldEqual "true" + read(2) shouldEqual Map("id" -> event.id.toString, "description" -> event.description) + } + it should "deserialize IntMap (Object values, duplicate keys - default mode)" in { val mapper = newMapper val json = """{"1": 123, "2": 123, "2": 123.456}""" diff --git a/src/test/scala/com/fasterxml/jackson/module/scala/deser/IterableDeserializerTest.scala b/src/test/scala/com/fasterxml/jackson/module/scala/deser/IterableDeserializerTest.scala index c05b5b5cc..a2483b403 100644 --- a/src/test/scala/com/fasterxml/jackson/module/scala/deser/IterableDeserializerTest.scala +++ b/src/test/scala/com/fasterxml/jackson/module/scala/deser/IterableDeserializerTest.scala @@ -14,4 +14,9 @@ class IterableDeserializerTest extends DeserializationFixture { val result = f.readValue(listJson, new TypeReference[Iterable[Int]] {}) result should equal (listScala) } + + it should "deserialize a list to an Iterable[_]" in { f => + val result = f.readValue(listJson, new TypeReference[Iterable[_]] {}) + result should equal(listScala) + } }