-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #739 from k163377/fix-nulls-fail
Make nulls = FAIL work even for primitives and missing
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github738.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,20 @@ | ||
package com.fasterxml.jackson.module.kotlin.test.github | ||
|
||
import com.fasterxml.jackson.annotation.JsonSetter | ||
import com.fasterxml.jackson.annotation.Nulls | ||
import com.fasterxml.jackson.databind.exc.MismatchedInputException | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import org.junit.Assert.assertThrows | ||
import org.junit.Test | ||
|
||
class Github738 { | ||
data class D(@JsonSetter(nulls = Nulls.FAIL) val v: Int) | ||
|
||
@Test | ||
fun test() { | ||
val mapper = jacksonObjectMapper() | ||
// nulls = FAIL is reflected if it is primitive and missing | ||
assertThrows(MismatchedInputException::class.java) { mapper.readValue<D>("{}") } | ||
} | ||
} |