Skip to content

Commit 86ec661

Browse files
committed
Add failing test for #242
1 parent 5d19da3 commit 86ec661

File tree

1 file changed

+24
-0
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
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)