org.junit.experimental.runners
Class Enclosed

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<Runner>
          extended by org.junit.runners.Suite
              extended by org.junit.experimental.runners.Enclosed
All Implemented Interfaces:
Describable, Filterable, Orderable, Sortable

public class Enclosed
extends Suite

If you put tests in inner classes, Ant, for example, won't find them. By running the outer class with Enclosed, the tests in the inner classes will be run. You might put tests in inner classes to group them for convenience or to share constants. Abstract inner classes are ignored.

So, for example:

 @RunWith(Enclosed.class)
 public class ListTests {
     ...useful shared stuff...
     public static class OneKindOfListTest {...}
     public static class AnotherKind {...}
     abstract public static class Ignored {...}
 }
 


Nested Class Summary
 
Nested classes/interfaces inherited from class org.junit.runners.Suite
Suite.SuiteClasses
 
Constructor Summary
Enclosed(Class<?> klass, RunnerBuilder builder)
          Only called reflectively.
 
Method Summary
 
Methods inherited from class org.junit.runners.Suite
describeChild, emptySuite, getChildren, runChild
 
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, 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 Detail

Enclosed

public Enclosed(Class<?> klass,
                RunnerBuilder builder)
         throws Throwable
Only called reflectively. Do not use programmatically.

Throws:
Throwable


Copyright © 2002–2020 JUnit. All rights reserved.