David
09/29/2023, 8:10 AMclass ComposePreviewTests {
@Test
fun ensureAllPreviewsArePrivate() {
allPreviewFunctions().assert {
it.hasPrivateModifier
}
}
@Test
fun ensureAllPreviewsStartWithPrefixPreview() {
allPreviewFunctions().assert {
it.name.startsWith("Preview")
}
}
private fun allPreviewFunctions() = Konsist.scopeFromProject().functions().withAllAnnotations("Preview")
}
igor.wojda
09/29/2023, 4:33 PM.withAnnotationOf(Preview::class)
to check by type rather than string.David
09/29/2023, 5:38 PM