Skip to content

Commit

Permalink
Resolved differences from 2.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
k163377 committed Nov 20, 2023
1 parent 58f6fb3 commit f8c7b4b
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package tools.jackson.module.kotlin.test.github.failing

import tools.jackson.databind.exc.UnrecognizedPropertyException
import tools.jackson.module.kotlin.jacksonObjectMapper
import tools.jackson.module.kotlin.readValue
import tools.jackson.module.kotlin.test.expectFailure
import org.junit.Test
import kotlin.test.assertEquals

Expand All @@ -20,15 +18,27 @@ class OwnerRequestTest {

@Test
fun testDeserHit340() {
expectFailure<UnrecognizedPropertyException>("GitHub #340 has been fixed!") {
val value: IsField = jackson.readValue(json)
assertEquals("Got a foo", value.foo)
}
val value: IsField = jackson.readValue(json)
// Fixed
assertEquals("Got a foo", value.foo)
}

@Test
fun testDeserWithoutIssue() {
val value: NoIsField = jackson.readValue(json)
assertEquals("Got a foo", value.foo)
}

// A test case for isSetter to work, added with the fix for this issue.
class IsSetter {
lateinit var isFoo: String
}

@Test
fun isSetterTest() {
val json = """{"isFoo":"bar"}"""
val isSetter: IsSetter = jackson.readValue(json)

assertEquals("bar", isSetter.isFoo)
}
}

0 comments on commit f8c7b4b

Please sign in to comment.