forked from FasterXML/jackson-module-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github242.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |