diff --git a/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub873.kt b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub873.kt new file mode 100644 index 00000000..69d2b238 --- /dev/null +++ b/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zPorted/test/github/GitHub873.kt @@ -0,0 +1,45 @@ +package io.github.projectmapk.jackson.module.kogera.zPorted.test.github + +import io.github.projectmapk.jackson.module.kogera.readValue +import io.github.projectmapk.jackson.module.kogera.defaultMapper +import org.junit.jupiter.api.Test + +class GitHub873 { + @Test + fun `should serialize value class`() { + + val person = Person( + mapOf( + "id" to "123", + "updated" to "2023-11-22 12:11:23", + "login" to "2024-01-15", + ), + ) + + val serialized = defaultMapper.writeValueAsString( + TimestampedPerson( + 123L, + Person(person.properties), + ) + ) + + val deserialized = defaultMapper.readValue(serialized) + + assert( + deserialized == TimestampedPerson( + 123L, + Person(person.properties), + ) + ) + } + + @JvmInline + value class Person( + val properties: Map, + ) + + data class TimestampedPerson( + val timestamp: Long, + val person: Person, + ) +}