File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/test/kotlin/tools/jackson/module/kotlin/test/github Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ package tools.jackson.module.kotlin.test.github
2+
3+ import com.fasterxml.jackson.annotation.JsonCreator
4+ import com.fasterxml.jackson.annotation.JsonInclude
5+ import tools.jackson.module.kotlin.jsonMapper
6+ import tools.jackson.module.kotlin.kotlinModule
7+ import tools.jackson.module.kotlin.readValue
8+ import kotlin.test.Test
9+ import kotlin.test.assertEquals
10+
11+ class GitHub841 {
12+ object Foo {
13+ override fun toString (): String = " Foo()"
14+
15+ @JvmStatic
16+ @JsonCreator
17+ fun deserialize (): Foo {
18+ return Foo
19+ }
20+ }
21+
22+ private val mapper = jsonMapper {
23+ changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude .Include .NON_ABSENT ) }
24+ addModule(kotlinModule())
25+ }
26+
27+ @Test
28+ fun shouldDeserializeSimpleObject () {
29+ val value = Foo
30+ val serialized = mapper.writeValueAsString(value)
31+ val deserialized = mapper.readValue<Foo >(serialized)
32+
33+ assertEquals(value, deserialized)
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments