Last active
January 10, 2020 22:12
-
-
Save lsoares/a3e725a08f185cb1564bdc477c706fd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `layered architecture`() { | |
layeredArchitecture() | |
.layer("web handlers").definedBy("..web.handlers") | |
.layer("use cases").definedBy("..usecases") | |
.layer("persistence").definedBy("..persistence") | |
.whereLayer("web handlers").mayNotBeAccessedByAnyLayer() | |
.whereLayer("use cases").mayOnlyBeAccessedByLayers("web handlers") | |
.whereLayer("persistence").mayOnlyBeAccessedByLayers("use cases") | |
.check(classes.that(are(not(equivalentTo(WebAppConfig::class.java))))) | |
} | |
java.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'Layered architecture consisting of | |
layer 'web handlers' ('..web.handlers') | |
layer 'use cases' ('..usecases') | |
layer 'persistence' ('..persistence') | |
where layer 'web handlers' may not be accessed by any layer | |
where layer 'use cases' may only be accessed by layers ['web handlers'] | |
where layer 'persistence' may only be accessed by layers ['use cases']' was violated (6 times): | |
Method <users.AppMainKt.main()> calls constructor <users.persistence.MySqlUserRepository.<init>(org.jetbrains.exposed.sql.Database)> in (AppMain.kt:13) | |
Method <users.AppMainKt.main()> calls method <users.persistence.MySqlUserRepository.createSchema()> in (AppMain.kt:13) | |
Method <users.WebAppConfig$javalinApp$1$2.addEndpoints()> calls constructor <users.usecases.CreateUser.<init>(users.domain.UserRepository)> in (AppMain.kt:27) | |
Method <users.WebAppConfig$javalinApp$1$2.addEndpoints()> calls constructor <users.usecases.ListUsers.<init>(users.domain.UserRepository)> in (AppMain.kt:26) | |
Method <users.WebAppConfig$javalinApp$1$2.addEndpoints()> calls constructor <users.web.handlers.CreateUser.<init>(users.usecases.CreateUser)> in (AppMain.kt:27) | |
Method <users.WebAppConfig$javalinApp$1$2.addEndpoints()> calls constructor <users.web.handlers.ListUsers.<init>(users.usecases.ListUsers)> in (AppMain.kt:26) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment