From 3f7f19a3c6f5d11ba7316b6e19ec96719b84634d Mon Sep 17 00:00:00 2001 From: reynisson Date: Mon, 29 Nov 2021 00:16:27 +0100 Subject: [PATCH] Architecture tests for roster --- roster/pom.xml | 6 ++++++ .../ch/unisg/roster/DependencyRuleTests.java | 20 +++++++++++++++++++ .../unisg/roster/RosterApplicationTests.java | 13 ------------ .../TapasTasksApplicationTests.java | 18 ----------------- 4 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 roster/src/test/java/ch/unisg/roster/DependencyRuleTests.java delete mode 100644 roster/src/test/java/ch/unisg/roster/RosterApplicationTests.java delete mode 100644 tapas-tasks/src/test/java/ch/unisg/tapastasks/TapasTasksApplicationTests.java diff --git a/roster/pom.xml b/roster/pom.xml index 8514b7b..1901982 100644 --- a/roster/pom.xml +++ b/roster/pom.xml @@ -83,6 +83,12 @@ org.springframework.boot spring-boot-starter-data-mongodb + + com.tngtech.archunit + archunit-junit4 + 0.22.0 + test + diff --git a/roster/src/test/java/ch/unisg/roster/DependencyRuleTests.java b/roster/src/test/java/ch/unisg/roster/DependencyRuleTests.java new file mode 100644 index 0000000..fd64ed5 --- /dev/null +++ b/roster/src/test/java/ch/unisg/roster/DependencyRuleTests.java @@ -0,0 +1,20 @@ +package ch.unisg.roster; + +import com.tngtech.archunit.core.importer.ClassFileImporter; +import org.junit.jupiter.api.Test; + +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; + +public class DependencyRuleTests { + @Test + void testPackageDependencies() { + noClasses() + .that() + .resideInAPackage("ch.unisg.roster.roster.domain..") + .should() + .dependOnClassesThat() + .resideInAnyPackage("ch.unisg.roster.roster.application..") + .check(new ClassFileImporter() + .importPackages("ch.unisg.roster.roster..")); + } +} diff --git a/roster/src/test/java/ch/unisg/roster/RosterApplicationTests.java b/roster/src/test/java/ch/unisg/roster/RosterApplicationTests.java deleted file mode 100644 index 5ee712b..0000000 --- a/roster/src/test/java/ch/unisg/roster/RosterApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package ch.unisg.roster; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class RosterApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/tapas-tasks/src/test/java/ch/unisg/tapastasks/TapasTasksApplicationTests.java b/tapas-tasks/src/test/java/ch/unisg/tapastasks/TapasTasksApplicationTests.java deleted file mode 100644 index a343151..0000000 --- a/tapas-tasks/src/test/java/ch/unisg/tapastasks/TapasTasksApplicationTests.java +++ /dev/null @@ -1,18 +0,0 @@ -package ch.unisg.tapastasks; - -import ch.unisg.tapastasks.tasks.application.port.out.AddTaskPort; -import ch.unisg.tapastasks.tasks.application.port.out.NewTaskAddedEventPort; -import ch.unisg.tapastasks.tasks.application.port.out.TaskListLock; -import ch.unisg.tapastasks.tasks.application.service.AddNewTaskToTaskListService; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class TapasTasksApplicationTests { - - @Test - void contextLoads() { - - } - -}