Slide 21
Slide 21 text
21
private static final JavaClasses CLASSES = new ClassFileImporter()
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("com.example");
@Test
void 一般的なレイヤーアーキテクチャ() {
layeredArchitecture()
.layer("ui").definedBy("com.example.presentation..")
.layer("app").definedBy("com.example.application..")
.layer("domain").definedBy("com.example.domain..")
.layer("infra").definedBy("com.example.infrastructure..")
.whereLayer("ui").mayNotBeAccessedByAnyLayer()
.whereLayer("app").mayOnlyBeAccessedByLayers("ui")
.whereLayer("domain").mayOnlyBeAccessedByLayers("ui", "app")
.whereLayer("infra").mayOnlyBeAccessedByLayers("ui", "app", "domain")
.check(CLASSES);
}