/DependencyRuleTests.java Secret
Last active
April 18, 2022 15:18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package buckpal.common; | |
import com.tngtech.archunit.core.importer.ClassFileImporter; | |
import org.junit.jupiter.api.Test; | |
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; | |
class DependencyRuleTests { | |
@Test | |
void domainLayerDoesNotDependOnApplicationLayer() { | |
noClasses() | |
.that() | |
.resideInAPackage("buckpal.domain..") | |
.should() | |
.dependOnClassesThat() | |
.resideInAnyPackage("buckpal.application..") | |
.check(new ClassFileImporter() | |
.importPackages("buckpal..")); | |
} | |
@Test | |
void validateRegistrationContextArchitecture() { | |
HexagonalArchitecture.boundedContext("account") | |
.withDomainLayer("domain") | |
.withAdaptersLayer("adapter") | |
.incoming("web") | |
.outgoing("persistence") | |
.and() | |
.withApplicationLayer("application") | |
.service("service") | |
.incomingPorts("port.in") | |
.outgoingPorts("port.out") | |
.and() | |
.withConfiguration("configuration") | |
.check(new ClassFileImporter() | |
.importPackages("buckpal..")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment