| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
public class BlockJUnit4ClassRunner
Implements the JUnit 4 standard test case class model, as defined by the
 annotations in the org.junit package. Many users will never notice this
 class: it is now the default test class runner, but it should have exactly
 the same behavior as the old test class runner (JUnit4ClassRunner).
 
 BlockJUnit4ClassRunner has advantages for writers of custom JUnit runners
 that are slight changes to the default behavior, however:
 
 
Statements,
 allowing new operations to be inserted into the appropriate point in the
 execution flow.
 
 JUnit4ClassRunner was in an internal package, and is now deprecated.
 
| Constructor Summary | |
|---|---|
| BlockJUnit4ClassRunner(java.lang.Class<?> klass)Creates a BlockJUnit4ClassRunner to run klass | |
| Method Summary | |
|---|---|
| protected  void | collectInitializationErrors(java.util.List<java.lang.Throwable> errors)Adds to errorsa throwable for each problem noted with the test class (available fromParentRunner.getTestClass()). | 
| protected  java.util.List<org.junit.runners.model.FrameworkMethod> | computeTestMethods()Returns the methods that run tests. | 
| protected  java.lang.Object | createTest()Returns a new fixture for running a test. | 
| protected  Description | describeChild(org.junit.runners.model.FrameworkMethod method)Returns a Descriptionforchild, which can be assumed to
 be an element of the list returned byParentRunner.getChildren() | 
| protected  java.util.List<org.junit.runners.model.FrameworkMethod> | getChildren()Returns a list of objects that define the children of this Runner. | 
| protected  org.junit.runners.model.Statement | methodBlock(org.junit.runners.model.FrameworkMethod method)Returns a Statement that, when executed, either returns normally if methodpasses, or throws an exception ifmethodfails. | 
| protected  org.junit.runners.model.Statement | methodInvoker(org.junit.runners.model.FrameworkMethod method,
              java.lang.Object test)Returns a Statementthat invokesmethodontest | 
| protected  org.junit.runners.model.Statement | possiblyExpectingExceptions(org.junit.runners.model.FrameworkMethod method,
                            java.lang.Object test,
                            org.junit.runners.model.Statement next)Returns a Statement: ifmethod's@Testannotation
 has theexpectingattribute, return normally only ifnextthrows an exception of the correct type, and throw an exception
 otherwise. | 
| protected  void | runChild(org.junit.runners.model.FrameworkMethod method,
         RunNotifier notifier)Runs the test corresponding to child, which can be assumed to be
 an element of the list returned byParentRunner.getChildren(). | 
| protected  java.lang.String | testName(org.junit.runners.model.FrameworkMethod method)Returns the name that describes methodforDescriptions. | 
| protected  void | validateInstanceMethods(java.util.List<java.lang.Throwable> errors)Adds to errorsfor each method annotated with@Test,@Before, or@Afterthat is not a public, void instance
 method with no arguments. | 
| protected  void | validateTestMethods(java.util.List<java.lang.Throwable> errors)Adds to errorsfor each method annotated with@Testthat
 is not a public, void instance method with no arguments. | 
| protected  void | validateZeroArgConstructor(java.util.List<java.lang.Throwable> errors)Adds to errorsif the test class's single constructor
 takes parameters | 
| protected  org.junit.runners.model.Statement | withAfters(org.junit.runners.model.FrameworkMethod method,
           java.lang.Object target,
           org.junit.runners.model.Statement statement)Returns a Statement: run all non-overridden@Aftermethods on this class and superclasses before runningnext; all
 After methods are always executed: exceptions thrown by previous steps
 are combined, if necessary, with exceptions from After methods into aMultipleFailureException. | 
| protected  org.junit.runners.model.Statement | withBefores(org.junit.runners.model.FrameworkMethod method,
            java.lang.Object target,
            org.junit.runners.model.Statement statement)Returns a Statement: run all non-overridden@Beforemethods on this class and superclasses before runningnext; if
 any throws an Exception, stop execution and pass the exception on. | 
| protected  org.junit.runners.model.Statement | withPotentialTimeout(org.junit.runners.model.FrameworkMethod method,
                     java.lang.Object test,
                     org.junit.runners.model.Statement next)Returns a Statement: ifmethod's@Testannotation
 has thetimeoutattribute, throw an exception ifnexttakes more than the specified number of milliseconds. | 
| Methods inherited from class org.junit.runners.ParentRunner | 
|---|
| childrenInvoker, classBlock, filter, getDescription, getName, getTestClass, run, 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 | 
| Methods inherited from interface org.junit.runner.manipulation.Filterable | 
|---|
| filter | 
| Methods inherited from interface org.junit.runner.manipulation.Sortable | 
|---|
| sort | 
| Constructor Detail | 
|---|
public BlockJUnit4ClassRunner(java.lang.Class<?> klass)
                       throws org.junit.runners.model.InitializationError
klass
org.junit.runners.model.InitializationError - if the test class is malformed.| Method Detail | 
|---|
protected void runChild(org.junit.runners.model.FrameworkMethod method,
                        RunNotifier notifier)
ParentRunnerchild, which can be assumed to be
 an element of the list returned by ParentRunner.getChildren().
 Subclasses are responsible for making sure that relevant test events are
 reported through notifier
runChild in class ParentRunner<org.junit.runners.model.FrameworkMethod>protected Description describeChild(org.junit.runners.model.FrameworkMethod method)
ParentRunnerDescription for child, which can be assumed to
 be an element of the list returned by ParentRunner.getChildren()
describeChild in class ParentRunner<org.junit.runners.model.FrameworkMethod>protected java.util.List<org.junit.runners.model.FrameworkMethod> getChildren()
ParentRunner
getChildren in class ParentRunner<org.junit.runners.model.FrameworkMethod>protected java.util.List<org.junit.runners.model.FrameworkMethod> computeTestMethods()
@Test on this 
 class and superclasses that are not overridden.
protected void collectInitializationErrors(java.util.List<java.lang.Throwable> errors)
ParentRunnererrors 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.
collectInitializationErrors in class ParentRunner<org.junit.runners.model.FrameworkMethod>protected void validateZeroArgConstructor(java.util.List<java.lang.Throwable> errors)
errors if the test class's single constructor
 takes parameters
protected void validateInstanceMethods(java.util.List<java.lang.Throwable> errors)
errors for each method annotated with @Test,
 @Before, or @After that is not a public, void instance
 method with no arguments.
protected void validateTestMethods(java.util.List<java.lang.Throwable> errors)
errors for each method annotated with @Testthat
 is not a public, void instance method with no arguments.
protected java.lang.Object createTest()
                               throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String testName(org.junit.runners.model.FrameworkMethod method)
method for Descriptions.
 Default implementation is the method's name
protected org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod method)
method passes, or throws an exception if method fails.
 
 Here is an outline of the default implementation:
 
 method on the result of createTest(), and
 throw any exceptions thrown by either operation.
 method's @Test annotation has the expecting attribute, return normally only if the previous step threw an
 exception of the correct type, and throw an exception otherwise.
 method's @Test annotation has the timeout attribute, throw an exception if the previous step takes more
 than the specified number of milliseconds.
 @Before methods on this class
 and superclasses before any of the previous steps; if any throws an
 Exception, stop execution and pass the exception on.
 @After methods on this class
 and superclasses before any of the previous steps; all After methods are
 always executed: exceptions thrown by previous steps are combined, if
 necessary, with exceptions from After methods into a
 MultipleFailureException.
 
protected org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod method,
                                                          java.lang.Object test)
Statement that invokes method on test
protected org.junit.runners.model.Statement possiblyExpectingExceptions(org.junit.runners.model.FrameworkMethod method,
                                                                        java.lang.Object test,
                                                                        org.junit.runners.model.Statement next)
Statement: if method's @Test annotation
 has the expecting attribute, return normally only if next
 throws an exception of the correct type, and throw an exception
 otherwise.
protected org.junit.runners.model.Statement withPotentialTimeout(org.junit.runners.model.FrameworkMethod method,
                                                                 java.lang.Object test,
                                                                 org.junit.runners.model.Statement next)
Statement: if method's @Test annotation
 has the timeout attribute, throw an exception if next
 takes more than the specified number of milliseconds.
protected org.junit.runners.model.Statement withBefores(org.junit.runners.model.FrameworkMethod method,
                                                        java.lang.Object target,
                                                        org.junit.runners.model.Statement statement)
Statement: run all non-overridden @Before
 methods on this class and superclasses before running next; if
 any throws an Exception, stop execution and pass the exception on.
protected org.junit.runners.model.Statement withAfters(org.junit.runners.model.FrameworkMethod method,
                                                       java.lang.Object target,
                                                       org.junit.runners.model.Statement statement)
Statement: run all non-overridden @After
 methods on this class and superclasses before running next; all
 After methods are always executed: exceptions thrown by previous steps
 are combined, if necessary, with exceptions from After methods into a
 MultipleFailureException.
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||