Skip to content

Commit

Permalink
Merge pull request #709 from k163377/failing-test-242
Browse files Browse the repository at this point in the history
Add failing test for #242
  • Loading branch information
k163377 committed Sep 10, 2023
2 parents 5d19da3 + 852ea18 commit 56dcfc6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions release-notes/CREDITS-2.x
Expand Up @@ -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
Expand Down
@@ -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<IntValue>("{}")
val v1 =objectMapper.readValue<IntValue>("{\"value\":null}")

assertEquals(0, v0.value)
assertEquals(v0, v1)
}
}

0 comments on commit 56dcfc6

Please sign in to comment.