Repository navigation
Expand file tree
/
Copy pathArchitectureTests.java
More file actions
50 lines (43 loc) · 1.7 KB
/
Copy pathArchitectureTests.java
File metadata and controls
50 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.taskmaster;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule;
/**
* Architectural fitness tests enforcing Hexagonal (Ports & Adapters) boundaries and modular monolith isolation.
*/
@AnalyzeClasses(
packages = "com.taskmaster",
importOptions = {ImportOption.DoNotIncludeTests.class}
)
class ArchitectureTests {
@ArchTest
static final ArchRule domainShouldNotDependOnAdapters =
noClasses()
.that().resideInAPackage("..domain..")
.should().dependOnClassesThat()
.resideInAPackage("..adapter..")
.allowEmptyShould(true);
@ArchTest
static final ArchRule applicationServicesShouldNotDependOnInboundAdapters =
noClasses()
.that().resideInAPackage("..application.service..")
.should().dependOnClassesThat()
.resideInAPackage("..adapter.in..")
.allowEmptyShould(true);
@ArchTest
static final ArchRule inboundAdaptersShouldNotDependOnOutboundAdapters =
noClasses()
.that().resideInAPackage("..adapter.in..")
.should().dependOnClassesThat()
.resideInAPackage("..adapter.out..")
.allowEmptyShould(true);
@ArchTest
static final ArchRule domainPortsShouldNotDependOnApplicationServices =
noClasses()
.that().resideInAPackage("..domain.port..")
.should().dependOnClassesThat()
.resideInAPackage("..application.service..")
.allowEmptyShould(true);
}