Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Oct 8, 2023
1 parent 95ed231 commit fad1aba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit fad1aba

Please sign in to comment.