Clean Architecture Snippets
Snippets used to guard clean architecture dependencies.
1. Clean Architecture Layers Have Correct Dependencies
@Test
fun `clean architecture layers have correct dependencies`() {
Konsist
.scopeFromProduction()
.assertArchitecture {
// Define layers
val domain = Layer("Domain", "com.myapp.domain..")
val presentation = Layer("Presentation", "com.myapp.presentation..")
val data = Layer("Data", "com.myapp.data..")
// Define architecture assertions
domain.dependsOnNothing()
presentation.dependsOn(domain)
data.dependsOn(domain)
}
}2. Classes With UseCase Suffix Should Reside In domain And usecase Package
UseCase Suffix Should Reside In domain And usecase Package3. Classes With UseCase Suffix Should Have Single public Operator Method Named invoke
UseCase Suffix Should Have Single public Operator Method Named invoke4. Classes With UseCase Suffix And Parents Should Have Single public Operator Method Named invoke
UseCase Suffix And Parents Should Have Single public Operator Method Named invoke5. Interfaces With Repository Annotation Should Reside In data Package
Repository Annotation Should Reside In data Package6. Every UseCase Class Has Test
Last updated