Architecture Snippets

Snippets used to guard application architecture.

1. 2 Layer Architecture Has Correct Dependencies

@Test
fun `2 layer architecture has correct dependencies`() {
    Konsist
        .scopeFromProject()
        .assertArchitecture {
            val presentation = Layer("Presentation", "com.myapp.presentation..")
            val business = Layer("Business", "com.myapp.business..")
            val persistence = Layer("Persistence", "com.myapp.persistence..")
            val database = Layer("Database", "com.myapp.database..")

            presentation.dependsOn(business)
            business.dependsOn(presentation)
            business.dependsOn(persistence)
            persistence.dependsOn(business)
            business.dependsOn(database)
            database.dependsOn(business)
        }
}

2. Every File In Module Reside In Module Specific Package

3. Files Reside In Package That Is Derived From Module Name

Last updated