Skip to content

Commit 56dcfc6

Browse files
authored
Merge pull request #709 from k163377/failing-test-242
Add failing test for #242
2 parents 5d19da3 + 852ea18 commit 56dcfc6

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

release-notes/CREDITS-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ kkurczewski
2121
* #689: Add KotlinDuration support
2222

2323
WrongWrong (@k163377)
24+
* #709: Add failing test for #242
2425
* #707: Changed to use default argument on null if JsonSetter(nulls = Nulls.SKIP) is specified.
2526
* #700: Reduce the load on the search process for serializers
2627
* #687: Optimize and Refactor KotlinValueInstantiator.createFromObjectWith
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github.failing
2+
3+
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
4+
import com.fasterxml.jackson.module.kotlin.readValue
5+
import org.junit.Test
6+
import kotlin.test.assertEquals
7+
8+
// Also see https://github.com/FasterXML/jackson-databind/issues/3392
9+
class Github242 {
10+
data class IntValue(val value: Int)
11+
12+
private val objectMapper = jacksonObjectMapper()
13+
14+
// Since `nullish` is entered for a `non-null` value, deserialization is expected to fail,
15+
// but at the moment the process continues with the default value set on the `databind`.
16+
@Test
17+
fun `test value throws - Int`(){
18+
val v0 =objectMapper.readValue<IntValue>("{}")
19+
val v1 =objectMapper.readValue<IntValue>("{\"value\":null}")
20+
21+
assertEquals(0, v0.value)
22+
assertEquals(v0, v1)
23+
}
24+
}

0 commit comments

Comments
 (0)