Changeset 1:207bb82a0645

Updated layer test
author unexist
date Sun, 14 Feb 2021 20:52:07 +0100
parents a60f2bfdc598
children db5652b28e13
files src/test/java/dev/unexist/showcase/todo/LayerArchUnitTest.java
diffstat 1 files changed, 13 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/java/dev/unexist/showcase/todo/LayerArchUnitTest.java	Sun Feb 14 18:40:51 2021 +0100
+++ b/src/test/java/dev/unexist/showcase/todo/LayerArchUnitTest.java	Sun Feb 14 20:52:07 2021 +0100
@@ -18,34 +18,30 @@
 
 import static com.tngtech.archunit.library.Architectures.layeredArchitecture;
 
-@AnalyzeClasses(packages = "dev.unexist.showcase")
+@AnalyzeClasses(packages = "dev.unexist.showcase.todo")
 public class LayerArchUnitTest {
-    private final JavaClasses classes = new ClassFileImporter().importPackages("dev.unexist");
+    private final JavaClasses classes = new ClassFileImporter().importPackages("dev.unexist.showcase.todo");
 
     @Test
     public void testLayeredArch() {
         layeredArchitecture()
-                .layer("Application")
+            .layer("Adapters")
+                .definedBy("..adapters..")
+            .layer("Application")
                 .definedBy("..application..")
-            .layer("Model")
-                .definedBy("..model..")
-            .layer("Service")
-                .definedBy("..service..")
-            .layer("Repository")
-                .definedBy("..repository..")
+            .layer("Domain")
+                .definedBy("..domain..")
             .layer("Infrastructure")
                 .definedBy("..infrastructure..")
 
-            .whereLayer("Application")
+            .whereLayer("Adapters")
                 .mayNotBeAccessedByAnyLayer()
-            .whereLayer("Service")
-                .mayOnlyBeAccessedByLayers("Application")
-            .whereLayer("Model")
-                .mayOnlyBeAccessedByLayers("Application", "Service", "Repository")
-            .whereLayer("Repository")
-                .mayOnlyBeAccessedByLayers("Service")
+            .whereLayer("Application")
+                .mayOnlyBeAccessedByLayers("Adapters")
+            .whereLayer("Domain")
+                .mayOnlyBeAccessedByLayers("Adapters", "Application")
             .whereLayer("Infrastructure")
-                .mayOnlyBeAccessedByLayers("Application", "Service", "Repository")
+                .mayOnlyBeAccessedByLayers("Adapters", "Application", "Infrastructure")
             .check(classes);
     }
 }