org.junit.experimental.theories
Class Theories

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.runners.ParentRunner<FrameworkMethod>
          extended by org.junit.runners.BlockJUnit4ClassRunner
              extended by org.junit.experimental.theories.Theories
All Implemented Interfaces:
Describable, Filterable, Sortable

public class Theories
extends BlockJUnit4ClassRunner


Nested Class Summary
static class Theories.TheoryAnchor
           
 
Constructor Summary
Theories(Class<?> klass)
           
 
Method Summary
protected  void collectInitializationErrors(List<Throwable> errors)
          Adds to errors a throwable for each problem noted with the test class (available from ParentRunner.getTestClass()).
protected  List<FrameworkMethod> computeTestMethods()
          Returns the methods that run tests.
 Statement methodBlock(FrameworkMethod method)
          Returns a Statement that, when executed, either returns normally if method passes, or throws an exception if method fails.
protected  void validateConstructor(List<Throwable> errors)
          Adds to errors if the test class has more than one constructor, or if the constructor takes parameters.
protected  void validateTestMethods(List<Throwable> errors)
          Adds to errors for each method annotated with @Testthat is not a public, void instance method with no arguments.
 
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
createTest, describeChild, getChildren, getTestRules, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateInstanceMethods, validateOnlyOneConstructor, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
 
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, filter, getDescription, getName, getTestClass, 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

Theories

public Theories(Class<?> klass)
         throws InitializationError
Throws:
InitializationError
Method Detail

collectInitializationErrors

protected void collectInitializationErrors(List<Throwable> errors)
Description copied from class: ParentRunner
Adds to errors a throwable for each problem noted with the test class (available from ParentRunner.getTestClass()). Default implementation adds an error for each method annotated with @BeforeClass or @AfterClass that is not public static void with no arguments.

Overrides:
collectInitializationErrors in class BlockJUnit4ClassRunner

validateConstructor

protected void validateConstructor(List<Throwable> errors)
Description copied from class: BlockJUnit4ClassRunner
Adds to errors if the test class has more than one constructor, or if the constructor takes parameters. Override if a subclass requires different validation rules.

Overrides:
validateConstructor in class BlockJUnit4ClassRunner

validateTestMethods

protected void validateTestMethods(List<Throwable> errors)
Description copied from class: BlockJUnit4ClassRunner
Adds to errors for each method annotated with @Testthat is not a public, void instance method with no arguments.

Overrides:
validateTestMethods in class BlockJUnit4ClassRunner

computeTestMethods

protected List<FrameworkMethod> computeTestMethods()
Description copied from class: BlockJUnit4ClassRunner
Returns the methods that run tests. Default implementation returns all methods annotated with @Test on this class and superclasses that are not overridden.

Overrides:
computeTestMethods in class BlockJUnit4ClassRunner

methodBlock

public Statement methodBlock(FrameworkMethod method)
Description copied from class: BlockJUnit4ClassRunner
Returns a Statement that, when executed, either returns normally if method passes, or throws an exception if method fails. Here is an outline of the default implementation: This can be overridden in subclasses, either by overriding this method, or the implementations creating each sub-statement.

Overrides:
methodBlock in class BlockJUnit4ClassRunner