Also, any thoughts on writing tests like this so t...
# konsist
e
Also, any thoughts on writing tests like this so that each is separate test?
Copy code
class ControllerConsistencyTests {
    @ParameterizedTest
    @MethodSource("controllers")
    fun `classes with @RestController annotation should have 'Controller' suffix`(controller: KoClassDeclaration) {
        controller.assert { it.hasNameEndingWith("Controller") }
    }

    companion object {
        @JvmStatic
        fun controllers() = Konsist.scopeFromProject().classes().withAllAnnotationsOf(RestController::class)
    }
}
added a little ext fun:
Copy code
fun <E : KoBaseProvider> E.assert(function: (E) -> Boolean) { listOf(this).assert(function) }
i
TBH I am not a fan of this approach as it add extra verbosity and no real value IMO (you don't change names of parameterised tests). This is the exact reason why `KoBaseProvider`\`KoBaseDeclaration` don't have
assert
. We have tried multiple iteration of the API, before and current one seems to be top in terms of low verbosity and usability. I would not recommend going this path.