org.jmock.integration.junit4
Class JMockTestClassMethodsRunner

java.lang.Object
  extended by org.junit.runner.Runner
      extended by org.junit.internal.runners.TestClassMethodsRunner
          extended by org.jmock.integration.junit4.JMockTestClassMethodsRunner
All Implemented Interfaces:
Filterable, Sortable

public class JMockTestClassMethodsRunner
extends org.junit.internal.runners.TestClassMethodsRunner

A JUnit 4 Runner that automatically verifies jMock expectations after the test has run. Use by passing JMock.class to the @RunWith annotation like this:

@RunWith(JMock.class)
 public class SomeMockObjectTests {
     Mockery context = new JUnit4Mockery();
     ...
 }
 
Note: the Mockery must be held in an instance variable of the class.

Author:
nat

Constructor Summary
JMockTestClassMethodsRunner(Class<?> testClass)
           
 
Method Summary
protected  org.junit.internal.runners.TestMethodRunner createMethodRunner(Object test, Method method, RunNotifier notifier)
           
protected  Field findMockeryField(Class testClass)
           
protected  Mockery mockeryOfTest(Object test)
           
 
Methods inherited from class org.junit.internal.runners.TestClassMethodsRunner
createTest, filter, getDescription, getName, getTestClass, invokeTestMethod, methodDescription, run, sort, testName
 
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

JMockTestClassMethodsRunner

public JMockTestClassMethodsRunner(Class<?> testClass)
                            throws org.junit.internal.runners.InitializationError
Throws:
org.junit.internal.runners.InitializationError
Method Detail

createMethodRunner

protected org.junit.internal.runners.TestMethodRunner createMethodRunner(Object test,
                                                                         Method method,
                                                                         RunNotifier notifier)
Overrides:
createMethodRunner in class org.junit.internal.runners.TestClassMethodsRunner

mockeryOfTest

protected Mockery mockeryOfTest(Object test)

findMockeryField

protected Field findMockeryField(Class testClass)
                          throws org.junit.internal.runners.InitializationError
Throws:
org.junit.internal.runners.InitializationError