If you want to dive right into the first ArchUnit test, follow these steps

Add ArchUnit as dependency

ArchUnit can be obtained from Maven Central.




dependencies {
    testCompile 'com.tngtech.archunit:archunit:0.5.0'

Create a test

import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import com.tngtech.archunit.lang.ArchRule;

import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;

public class MyArchitectureTest {
    public void some_architecture_rule() {
        JavaClasses importedClasses = new ClassFileImporter().importPackages("com.myapp");
        ArchRule rule = classes()... // see next section

Let the API guide you

ArchUnit Fluent API

How to continue

For further information, for example how to use the extended JUnit 4 support supplying caching and more, check out the User Guide or examples for the current release at ArchUnit Examples.