Skip to content

Commit e116b4f

Browse files
committed
Porting check for #844
from FasterXML/jackson-module-kotlin#855
1 parent f0920c6 commit e116b4f

File tree

1 file changed

+30
-0
lines changed
  • src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github

1 file changed

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

0 commit comments

Comments
 (0)