Comment on page
Kotlin Serialization Snippets
@Test
fun `classes annotated with 'Serializable' have all properties annotated with 'SerialName'`() {
Konsist
.scopeFromProject()
.classes()
.withAnnotationOf(Serializable::class)
.properties()
.assertTrue {
it.hasAnnotationOf(SerialName::class)
}
}
@Test
fun `enum classes annotated with 'Serializable' have all enum constants annotated with 'SerialName'`() {
Konsist.scopeFromProject()
.classes()
.withEnumModifier()
.withAnnotationOf(Serializable::class)
.enumConstants
.assertTrue { it.hasAnnotationOf(SerialName::class) }
}
Last modified 1mo ago