Skip to content

Commit

Permalink
Merge remote-tracking branch 'FasterXML/2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
k163377 committed Nov 16, 2024
2 parents ea567b8 + 64d18fd commit 36be0ef
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tools.jackson.module.kotlin.test.github

import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonInclude
import tools.jackson.module.kotlin.jsonMapper
import tools.jackson.module.kotlin.kotlinModule
import tools.jackson.module.kotlin.readValue
import kotlin.test.Test
import kotlin.test.assertEquals

class GitHub841 {
object Foo {
override fun toString(): String = "Foo()"

@JvmStatic
@JsonCreator
fun deserialize(): Foo {
return Foo
}
}

private val mapper = jsonMapper {
changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude.Include.NON_ABSENT) }
addModule(kotlinModule())
}

@Test
fun shouldDeserializeSimpleObject() {
val value = Foo
val serialized = mapper.writeValueAsString(value)
val deserialized = mapper.readValue<Foo>(serialized)

assertEquals(value, deserialized)
}
}

0 comments on commit 36be0ef

Please sign in to comment.