Skip to content

Commit 78f055c

Browse files
committed
Merge branch '2.18' into 2.19
2 parents 0d54fe6 + 1bf0ad7 commit 78f055c

File tree

1 file changed

+32
-0
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonAnyGetter
4+
import com.fasterxml.jackson.annotation.JsonAnySetter
5+
import com.fasterxml.jackson.databind.ObjectMapper
6+
import com.fasterxml.jackson.module.kotlin.KotlinModule
7+
import com.fasterxml.jackson.module.kotlin.readValue
8+
import kotlin.test.Test
9+
import kotlin.test.assertEquals
10+
11+
class GitHub832 {
12+
data class AnySetter @JvmOverloads constructor(
13+
val test: String? = null,
14+
@JsonAnySetter
15+
@get:JsonAnyGetter
16+
val anything: Map<String, Any?> = mutableMapOf(),
17+
)
18+
19+
@Test
20+
fun testDeserialization() {
21+
val json = """
22+
{
23+
"widget": {
24+
"debug": "on"
25+
}
26+
} """.trimMargin()
27+
val jacksonMapper = ObjectMapper()
28+
jacksonMapper.registerModules(KotlinModule.Builder().build())
29+
val anySetter = jacksonMapper.readValue<AnySetter>(json)
30+
assertEquals("widget", anySetter.anything.entries.first().key)
31+
}
32+
}

0 commit comments

Comments
 (0)