Skip to content

Commit 5b65f56

Browse files
committed
Add tests for #630
1 parent cbbcfbe commit 5b65f56

File tree

1 file changed

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

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty
4+
import com.fasterxml.jackson.databind.ObjectMapper
5+
import com.fasterxml.jackson.module.kotlin.KotlinFeature
6+
import com.fasterxml.jackson.module.kotlin.KotlinModule
7+
import org.junit.Test
8+
import kotlin.test.assertEquals
9+
10+
class Github630 {
11+
private val mapper = ObjectMapper()
12+
.registerModule(KotlinModule.Builder().enable(KotlinFeature.UseKotlinPropertyNameForGetter).build())!!
13+
14+
data class Dto(
15+
// from #570, #603
16+
val FOO: Int = 0,
17+
val bAr: Int = 0,
18+
@JsonProperty("b")
19+
val BAZ: Int = 0,
20+
@JsonProperty("q")
21+
val qUx: Int = 0,
22+
// from #71
23+
internal val quux: Int = 0,
24+
// from #434
25+
val `corge-corge`: Int = 0,
26+
// additional
27+
@get:JvmName("aaa")
28+
val grault: Int = 0
29+
)
30+
31+
@Test
32+
fun test() {
33+
val dto = Dto()
34+
35+
assertEquals(
36+
"""{"FOO":0,"bAr":0,"b":0,"q":0,"quux":0,"corge-corge":0,"grault":0}""",
37+
mapper.writeValueAsString(dto)
38+
)
39+
}
40+
}

0 commit comments

Comments
 (0)