Skip to content

Commit 59c8d88

Browse files
committed
Test case for #194
1 parent 791d854 commit 59c8d88

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

release-notes/CREDITS-2.x

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ Authors:
1313

1414
Contributors:
1515

16+
Christopher Mason (masoncj@github)
17+
* #194: Contributed test case for @JsonIdentityInfo usage
18+
(2.12.NEXT)
19+
20+
Martin Häusler (MartinHaeusler@github)
21+
* Reported #194: @JsonIdentityInfo bug
22+
(2.12.NEXT)
23+
1624
Eric Fenderbosch (efenderbosch@github)
1725
* Fixed #182: Serialize unsigned numbers
1826
(2.12.2)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github
2+
3+
import com.fasterxml.jackson.annotation.JsonIdentityInfo
4+
import com.fasterxml.jackson.annotation.ObjectIdGenerators
5+
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
6+
import org.junit.Test
7+
import java.util.UUID
8+
import kotlin.test.assertEquals
9+
10+
class TestGithub194 {
11+
val id: UUID = UUID.fromString("149800a6-7855-4e09-9185-02e442da8013")
12+
val json = """{"id": "$id", "name": "Foo"}"""
13+
14+
@Test
15+
fun testIdentityInfo() {
16+
val mapper = jacksonObjectMapper()
17+
val value = mapper.readValue(json, WithIdentity::class.java)
18+
assertEquals(id, value.id)
19+
assertEquals(id.toString(), value.idString)
20+
assertEquals("Foo", value.name)
21+
}
22+
}
23+
24+
@JsonIdentityInfo(
25+
property = "id",
26+
scope = WithIdentity::class,
27+
generator = ObjectIdGenerators.PropertyGenerator::class
28+
)
29+
class WithIdentity(val id: UUID = UUID.randomUUID(),
30+
val idString: String = id.toString(),
31+
val name: String)

0 commit comments

Comments
 (0)