Comment on page
JUnit Snippets
@Test
fun `classes with 'Test' Annotation should have 'Test' suffix`() {
Konsist
.scopeFromSourceSet("test")
.classes()
.filter { it.functions().any { func -> func.hasAnnotationOf(Test::class) } }
.assertTrue { it.hasNameEndingWith("Tests") }
}
@Test
fun `don't use JUnit4 Test annotation`() {
Konsist
.scopeFromProject()
.classes()
.functions()
.assertFalse {
it.annotations.any { annotation ->
annotation.fullyQualifiedName == "org.junit.Test"
}
}
}
Last modified 1mo ago