Skip to content

Commit 289efe0

Browse files
authored
Merge pull request #1103 from k163377/github1065
Add test case for #1065
2 parents 077308c + 785cff3 commit 289efe0

File tree

1 file changed

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

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package tools.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude
4+
import org.junit.jupiter.api.Assertions.assertDoesNotThrow
5+
import tools.jackson.module.kotlin.jacksonMapperBuilder
6+
import kotlin.test.Test
7+
import kotlin.test.assertEquals
8+
9+
class GitHub1065 {
10+
data class Vehicle(val id: VehicleId?)
11+
12+
@JvmInline
13+
value class VehicleId(val value: String)
14+
15+
@Test
16+
fun test() {
17+
val mapper = jacksonMapperBuilder()
18+
.apply {
19+
changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude.Include.NON_EMPTY) }
20+
}.build()
21+
22+
val dto = Vehicle(id = VehicleId("vehicle-1"))
23+
24+
assertDoesNotThrow {
25+
assertEquals(
26+
"""{"id":"vehicle-1"}""",
27+
mapper.writeValueAsString(dto)
28+
)
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)