added archunit test for some little architectural rule testing
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
<version.bpmAssert>1.1.0</version.bpmAssert>
|
||||
<version.camundaMockito>6.17.0</version.camundaMockito>
|
||||
<version.okhttp>4.9.3</version.okhttp>
|
||||
<version.archunitJunit5>0.23.1</version.archunitJunit5>
|
||||
<version.surefirePlugin>3.0.0-M6</version.surefirePlugin>
|
||||
</properties>
|
||||
|
||||
@@ -145,6 +146,12 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tngtech.archunit</groupId>
|
||||
<artifactId>archunit-junit5</artifactId>
|
||||
<version>${version.archunitJunit5}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Amount extends ValueObject<Integer> {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o != null && this.getClass() == o.getClass()) {
|
||||
ValueObject<Integer> valueObject = (ValueObject)o;
|
||||
ValueObject valueObject = (ValueObject)o;
|
||||
return (valueObject.getValue()).equals(this.getValue());
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.weinbrecht.luc.bpm.architecture.loan.agreement;
|
||||
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
||||
|
||||
@AnalyzeClasses(packages = "de.weinbrecht.luc.bpm.architecture.loan.agreement")
|
||||
class ArchitectureRuleTests {
|
||||
private final static String DOMAIN = "..domain..";
|
||||
private final static String USE_CASE = "..usecase..";
|
||||
private final static String ADAPTER = "..adapter..";
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule domain_use_case_should_not_import_adapters =
|
||||
noClasses()
|
||||
.that().resideInAPackage(DOMAIN)
|
||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule use_case_should_not_import_adapters =
|
||||
noClasses()
|
||||
.that().resideInAPackage(USE_CASE)
|
||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
<version.domainprimitives>0.1.0</version.domainprimitives>
|
||||
<version.bpmAssert>1.1.0</version.bpmAssert>
|
||||
<version.camundaMockito>6.17.0</version.camundaMockito>
|
||||
<version.archunitJunit5>0.23.1</version.archunitJunit5>
|
||||
<version.surefirePlugin>3.0.0-M6</version.surefirePlugin>
|
||||
</properties>
|
||||
|
||||
@@ -126,6 +127,13 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tngtech.archunit</groupId>
|
||||
<artifactId>archunit-junit5</artifactId>
|
||||
<version>${version.archunitJunit5}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.weinbrecht.luc.bpm.architecture.recommendation;
|
||||
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
||||
|
||||
@AnalyzeClasses(packages = "de.weinbrecht.luc.bpm.architecture.recommendation")
|
||||
class ArchitectureRuleTests {
|
||||
private final static String DOMAIN = "..domain..";
|
||||
private final static String USE_CASE = "..usecase..";
|
||||
private final static String ADAPTER = "..adapter..";
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule domain_use_case_should_not_import_adapters =
|
||||
noClasses()
|
||||
.that().resideInAPackage(DOMAIN)
|
||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule use_case_should_not_import_adapters =
|
||||
noClasses()
|
||||
.that().resideInAPackage(USE_CASE)
|
||||
.should().accessClassesThat().resideInAPackage(ADAPTER);
|
||||
}
|
||||
Reference in New Issue
Block a user