Skip to content

Commit 4dfa2d6

Browse files
committed
Add test without default ID
1 parent 59c8d88 commit 4dfa2d6

File tree

1 file changed

+27
-9
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github

1 file changed

+27
-9
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github194.kt

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,31 @@ class TestGithub194 {
1919
assertEquals(id.toString(), value.idString)
2020
assertEquals("Foo", value.name)
2121
}
22-
}
2322

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)
23+
@JsonIdentityInfo(
24+
property = "id",
25+
scope = WithIdentity::class,
26+
generator = ObjectIdGenerators.PropertyGenerator::class
27+
)
28+
class WithIdentity(val id: UUID,
29+
val idString: String = id.toString(),
30+
val name: String)
31+
32+
@Test
33+
fun testIdentityInfo_WithDefaultId() {
34+
val mapper = jacksonObjectMapper()
35+
val value = mapper.readValue(json, WithIdentityAndDefaultId::class.java)
36+
assertEquals(id, value.id)
37+
assertEquals(id.toString(), value.idString)
38+
assertEquals("Foo", value.name)
39+
}
40+
41+
@JsonIdentityInfo(
42+
property = "id",
43+
scope = WithIdentityAndDefaultId::class,
44+
generator = ObjectIdGenerators.PropertyGenerator::class
45+
)
46+
class WithIdentityAndDefaultId(val id: UUID,
47+
val idString: String = id.toString(),
48+
val name: String)
49+
}

0 commit comments

Comments
 (0)