Archunit test
ArchUnit integrates nicely with the JUnit test framework, and so, they are typically used together. All we have to do is add the archunit-junit 5 dependency to match our JUnit version: < dependency > < groupId > com.tngtech.archunit </ groupId > < artifactId > archunit-junit5 </ artifactId > < version > 0.14.1 </ version > < scope > test </ scope > </ dependency > Step 1: The first step is to create a set of Java classes that will be checked for rules violations . We do this by instantiating the ClassFileImporter class and then using one of its importXXX() methods: JavaClasses jc = new ClassFileImporter () .importPackages( "com.baeldung.archunit.smurfs" ); Step 2: Let’s try to implement the first rule defined above using this API. We’ll use the classes() method as our anchor and add additional constraints ...