Annotation Interface ArchTest


@Target({FIELD,METHOD}) @Retention(RUNTIME) public @interface ArchTest
Marks ArchUnit tests to be executed by the test infrastructure. These tests can have the following form:
  • A static field of type ArchRule -> this rule will automatically be checked against the imported classes
  • A static method with one parameter JavaClasses -> this method will be called with the imported classes

Example:

@ArchTest
 public static final ArchRule someRule = classes()... ;

@ArchTest
 public static void someMethod(JavaClasses classes) {
     // do something with classes
 }