For the complete documentation index, see llms.txt. This page is also available as Markdown.

Architecture Test Snippets

Snippets used to guard application architecture.

1. 4 Layer Architecture Has Correct Dependencies

@Test
fun `4 layer architecture has correct dependencies`() {
    Konsist
        .scopeFromProduction()
        .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(persistence)
            persistence.dependsOn(database)
            database.dependsOnNothing()
        }
}

2. Hexagonal Architecture Has Correct Dependencies

3. Every File In Module Resides In Module-specific Package

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

Last updated