Konsist: add test Data class state MUST not have default value, and fix existing issues
This commit is contained in:
parent
8929a90970
commit
d55df22db2
13 changed files with 135 additions and 56 deletions
|
|
@ -22,6 +22,7 @@ import com.lemonappdev.konsist.api.Konsist
|
|||
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutModifier
|
||||
import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
|
||||
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
|
||||
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
|
||||
import com.lemonappdev.konsist.api.ext.list.withTopLevel
|
||||
import com.lemonappdev.konsist.api.ext.list.withoutName
|
||||
import com.lemonappdev.konsist.api.ext.list.withoutNameEndingWith
|
||||
|
|
@ -84,4 +85,19 @@ class KonsistTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Data class state MUST not have default value`() {
|
||||
Konsist
|
||||
.scopeFromProject()
|
||||
.classes()
|
||||
.withNameEndingWith("State")
|
||||
.assertTrue { classDeclaration ->
|
||||
classDeclaration.constructors.all { constructorDeclaration ->
|
||||
constructorDeclaration.parameters.all { parameterDeclaration ->
|
||||
parameterDeclaration.defaultValue == null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue