test(backend): add ArchUnit domain boundary enforcement (Rules 1–4) #428
@@ -86,6 +86,20 @@ class ArchitectureTest {
|
||||
.and().resideInAPackage("..ocr..")
|
||||
.should().dependOnClassesThat(foreignJpaRepositoryFor("ocr"));
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule services_only_access_own_domain_repositories_importing =
|
||||
noClasses()
|
||||
.that().areAnnotatedWith(Service.class)
|
||||
.and().resideInAPackage("..importing..")
|
||||
.should().dependOnClassesThat(foreignJpaRepositoryFor("importing"));
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule services_only_access_own_domain_repositories_audit =
|
||||
noClasses()
|
||||
.that().areAnnotatedWith(Service.class)
|
||||
.and().resideInAPackage("..audit..")
|
||||
.should().dependOnClassesThat(foreignJpaRepositoryFor("audit"));
|
||||
|
||||
// Rule 3: Infrastructure @Configuration classes must not end up scattered in domain packages.
|
||||
// Keeps cross-cutting setup (security, async, DB, storage) in dedicated packages
|
||||
// where it can be audited and reasoned about independently.
|
||||
|
||||
Reference in New Issue
Block a user