Skip to content

Commit e97b2ce

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

File tree

1 file changed

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

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
@get:JvmName("aaa")
27+
val grault: Int = 0
28+
)
29+
30+
@Test
31+
fun test() {
32+
val dto = Dto()
33+
34+
assertEquals(
35+
"""{"FOO":0,"bAr":0,"b":0,"q":0,"quux":0,"corge-corge":0,"grault":0}""",
36+
mapper.writeValueAsString(dto)
37+
)
38+
}
39+
}

0 commit comments

Comments
 (0)