From 749bd7e99a5e25124434b8cba97d8bcc2f425459 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 31 Jul 2020 15:26:27 +0430 Subject: [PATCH 1/2] Improve the Kotlin Jackson module --- .../kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt index 84171d9019..95df57fb1e 100644 --- a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt +++ b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt @@ -59,7 +59,11 @@ class JacksonUnitTest { val aMap: Map = mapper.readValue(json) assertEquals(aMap[1], "one") - assertEquals(aMap[2], "two") + assertEquals(aMap[2], "two") + + val sameMap = mapper.readValue>(json) + assertEquals(sameMap[1], "one") + assertEquals(sameMap[2], "two") } @Test From 508b4a2939cb8170a75c51ac20a3b3c65c6519f9 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 31 Jul 2020 15:31:51 +0430 Subject: [PATCH 2/2] Added Reified Style to the List Example --- .../kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt index 95df57fb1e..0c72edc2fd 100644 --- a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt +++ b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt @@ -85,7 +85,11 @@ class JacksonUnitTest { val movie1 = Movie("Endgame", "Marvel", 9.2f) val movie2 = Movie("Shazam", "Warner Bros", 7.6f) assertTrue(movieList.contains(movie1)) - assertTrue(movieList.contains(movie2)) + assertTrue(movieList.contains(movie2)) + + val sameList = mapper.readValue>(json) + assertTrue(sameList.contains(movie1)) + assertTrue(sameList.contains(movie2)) } @Test