diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 0c0fb820..b3bb15b1 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -21,6 +21,7 @@ kkurczewski * #689: Add KotlinDuration support WrongWrong (@k163377) +* #709: Add failing test for #242 * #707: Changed to use default argument on null if JsonSetter(nulls = Nulls.SKIP) is specified. * #700: Reduce the load on the search process for serializers * #687: Optimize and Refactor KotlinValueInstantiator.createFromObjectWith diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github242.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github242.kt new file mode 100644 index 00000000..5a2e9a70 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github242.kt @@ -0,0 +1,24 @@ +package com.fasterxml.jackson.module.kotlin.test.github.failing + +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Test +import kotlin.test.assertEquals + +// Also see https://github.com/FasterXML/jackson-databind/issues/3392 +class Github242 { + data class IntValue(val value: Int) + + private val objectMapper = jacksonObjectMapper() + + // Since `nullish` is entered for a `non-null` value, deserialization is expected to fail, + // but at the moment the process continues with the default value set on the `databind`. + @Test + fun `test value throws - Int`(){ + val v0 =objectMapper.readValue("{}") + val v1 =objectMapper.readValue("{\"value\":null}") + + assertEquals(0, v0.value) + assertEquals(v0, v1) + } +}