test(backend): add ArchUnit domain boundary enforcement (Rules 1–4) #428

Merged
marcel merged 3 commits from feat/issue-409-archunit into main 2026-05-05 18:08:40 +02:00
Showing only changes of commit 0981355247 - Show all commits

View File

@@ -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.