Skip to content

Commit f36c52a

Browse files
committed
Merge remote-tracking branch 'FasterXML/2.19'
2 parents 28a1dbb + a15c278 commit f36c52a

File tree

1 file changed

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

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package tools.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonTypeInfo
4+
import tools.jackson.module.kotlin.readValue
5+
import tools.jackson.module.kotlin.jsonMapper
6+
import kotlin.test.Test
7+
import kotlin.test.assertEquals
8+
9+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "_type")
10+
private sealed class BaseClass
11+
12+
private data class ChildClass(val text: String) : BaseClass()
13+
14+
class GitHub844 {
15+
@Test
16+
fun test() {
17+
val json = """
18+
{
19+
"_type": "ChildClass",
20+
"text": "Test"
21+
}
22+
"""
23+
24+
val jacksonObjectMapper = jsonMapper()
25+
val message = jacksonObjectMapper.readValue<BaseClass>(json)
26+
27+
assertEquals(ChildClass("Test"), message)
28+
}
29+
}

0 commit comments

Comments
 (0)