Код: Выделить всё
@AnalyzeClasses(packages = "com.myapp", importOptions = ImportOption.DoNotIncludeTests.class)
public class LayeredArchitectureTests {
@ArchTest
static final ArchRule testLayerDependencies = layeredArchitecture().consideringAllDependencies()
.layer("Controllers").definedBy(HasAnnotations.Predicates.annotatedWith(RestController.class))
.layer("Services").definedBy(HasAnnotations.Predicates.annotatedWith(Service.class))
.layer("Repositories").definedBy(JavaClass.Predicates.assignableTo(Repository.class))
.whereLayer("Repositories").mayOnlyBeAccessedByLayers("Services", "Repositories");
}
Код: Выделить всё
// this mayNotBeAccessedByLayers method doesn't actually exist
.whereLayer("Repositories").mayNotBeAccessedByLayers("Controllers");
Подробнее здесь: https://stackoverflow.com/questions/791 ... ng-another
Мобильная версия