Class ArchUnitRunner

  • All Implemented Interfaces:
    org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable

    @PublicAPI(usage=ACCESS)
    public class ArchUnitRunner
    extends org.junit.runners.ParentRunner<com.tngtech.archunit.junit.ArchTestExecution>
    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.
    • Constructor Summary

      Constructors 
      Constructor Description
      ArchUnitRunner​(java.lang.Class<?> testClass)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.junit.runners.model.Statement classBlock​(org.junit.runner.notification.RunNotifier notifier)  
      protected org.junit.runner.Description describeChild​(com.tngtech.archunit.junit.ArchTestExecution child)  
      protected java.util.List<com.tngtech.archunit.junit.ArchTestExecution> getChildren()  
      protected void runChild​(com.tngtech.archunit.junit.ArchTestExecution 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, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses
      • 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 Detail

      • ArchUnitRunner

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

      • classBlock

        protected org.junit.runners.model.Statement classBlock​(org.junit.runner.notification.RunNotifier notifier)
        Overrides:
        classBlock in class org.junit.runners.ParentRunner<com.tngtech.archunit.junit.ArchTestExecution>
      • getChildren

        protected java.util.List<com.tngtech.archunit.junit.ArchTestExecution> getChildren()
        Specified by:
        getChildren in class org.junit.runners.ParentRunner<com.tngtech.archunit.junit.ArchTestExecution>
      • describeChild

        protected org.junit.runner.Description describeChild​(com.tngtech.archunit.junit.ArchTestExecution child)
        Specified by:
        describeChild in class org.junit.runners.ParentRunner<com.tngtech.archunit.junit.ArchTestExecution>
      • runChild

        protected void runChild​(com.tngtech.archunit.junit.ArchTestExecution child,
                                org.junit.runner.notification.RunNotifier notifier)
        Specified by:
        runChild in class org.junit.runners.ParentRunner<com.tngtech.archunit.junit.ArchTestExecution>