File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ package io.github.projectmapk.jackson.module.kogera.zPorted.test.github
2+
3+ import io.github.projectmapk.jackson.module.kogera.readValue
4+ import io.github.projectmapk.jackson.module.kogera.defaultMapper
5+ import org.junit.jupiter.api.Test
6+
7+ class GitHub873 {
8+ @Test
9+ fun `should serialize value class` () {
10+
11+ val person = Person (
12+ mapOf (
13+ " id" to " 123" ,
14+ " updated" to " 2023-11-22 12:11:23" ,
15+ " login" to " 2024-01-15" ,
16+ ),
17+ )
18+
19+ val serialized = defaultMapper.writeValueAsString(
20+ TimestampedPerson (
21+ 123L ,
22+ Person (person.properties),
23+ )
24+ )
25+
26+ val deserialized = defaultMapper.readValue<TimestampedPerson >(serialized)
27+
28+ assert (
29+ deserialized == TimestampedPerson (
30+ 123L ,
31+ Person (person.properties),
32+ )
33+ )
34+ }
35+
36+ @JvmInline
37+ value class Person (
38+ val properties : Map <String , Any >,
39+ )
40+
41+ data class TimestampedPerson (
42+ val timestamp : Long ,
43+ val person : Person ,
44+ )
45+ }
You can’t perform that action at this time.
0 commit comments