@Test
fun `all generic return types contain X in their name`() {
Konsist
.scopeFromProduction()
.functions()
.returnTypes
.withGeneric()
.assertTrue { it.hasNameContaining("X") }
}
@Test
fun `property generic type does not contains star projection`() {
Konsist
.scopeFromProduction()
.properties()
.types
.assertFalse { type ->
type
.typeArguments
?.flatten()
?.any { it.isStarProjection }
}
}
@Test
fun `all generic return types contain Kotlin collection type argument`() {
Konsist
.scopeFromProduction()
.functions()
.returnTypes
.withGeneric()
.typeArguments
.assertTrue { it.sourceDeclaration?.isKotlinCollectionType }
}
@Test
fun `function parameter has generic type argument with name ending with 'Repository'`() {
Konsist
.scopeFromProduction()
.functions()
.parameters
.types
.withGeneric()
.sourceDeclarations()
.assertFalse { it.hasNameEndingWith("Repository") }
}