Skip to content

Commit 36be0ef

Browse files
committed
Merge remote-tracking branch 'FasterXML/2.19'
2 parents ea567b8 + 64d18fd commit 36be0ef

File tree

1 file changed

+35
-0
lines changed
  • src/test/kotlin/tools/jackson/module/kotlin/test/github

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}

0 commit comments

Comments
 (0)