Class ArchUnitRunner<T>

java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<T>
com.tngtech.archunit.junit.ArchUnitRunner<T>
All Implemented Interfaces:
org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

@PublicAPI(usage=ACCESS) public class ArchUnitRunner<T> extends org.junit.runners.ParentRunner<T>
Evaluates ArchRules against the classes inside of the packages specified via @AnalyzeClasses on the annotated test class.

NOTE: The runner demands @AnalyzeClasses to be present on the respective test class.

Example:

@RunWith(ArchUnitRunner.class)
@AnalyzeClasses(packages = "com.example")
 public class SomeArchTest {
    @ArchTest
     public static final ArchRule some_rule = //...
 }
 
The runner will cache classes between test runs, for details please refer to ClassCache.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArchUnitRunner(Class<?> testClass)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.junit.runners.model.Statement
    classBlock(org.junit.runner.notification.RunNotifier notifier)
     
    protected org.junit.runner.Description
     
    protected List<T>
     
    protected void
    runChild(T child, org.junit.runner.notification.RunNotifier notifier)
     

    Methods inherited from class org.junit.runners.ParentRunner

    childrenInvoker, classRules, collectInitializationErrors, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, isIgnored, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArchUnitRunner

      @Internal public ArchUnitRunner(Class<?> testClass) throws org.junit.runners.model.InitializationError
      Throws:
      org.junit.runners.model.InitializationError
  • Method Details

    • classBlock

      protected org.junit.runners.model.Statement classBlock(org.junit.runner.notification.RunNotifier notifier)
      Overrides:
      classBlock in class org.junit.runners.ParentRunner<T>
    • getChildren

      protected List<T> getChildren()
      Specified by:
      getChildren in class org.junit.runners.ParentRunner<T>
    • describeChild

      protected org.junit.runner.Description describeChild(T child)
      Specified by:
      describeChild in class org.junit.runners.ParentRunner<T>
    • runChild

      protected void runChild(T child, org.junit.runner.notification.RunNotifier notifier)
      Specified by:
      runChild in class org.junit.runners.ParentRunner<T>