diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cc249f8..df6bfd6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin = "1.9.25" # Mainly for CI, it can be rewritten by environment variable. -jackson = "2.18.1" +jackson = "2.18.2" # test libs junit = "5.11.3" diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt new file mode 100644 index 0000000..75a7640 --- /dev/null +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub841.kt @@ -0,0 +1,34 @@ +package io.github.projectmapk.jackson.module.kogera.zPorted.test.github + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.databind.ObjectMapper +import io.github.projectmapk.jackson.module.kogera.readValue +import io.github.projectmapk.jackson.module.kogera.registerKotlinModule +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +class GitHub841 { + object Foo { + override fun toString(): String = "Foo()" + + @JvmStatic + @JsonCreator + fun deserialize(): Foo { + return Foo + } + } + + private val mapper = ObjectMapper() + .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) + .registerKotlinModule() + + @Test + fun shouldDeserializeSimpleObject() { + val value = Foo + val serialized = mapper.writeValueAsString(value) + val deserialized = mapper.readValue(serialized) + + assertEquals(value, deserialized) + } +}