net.sf.twip.jmock
Class JMockExtension

java.lang.Object
  extended by net.sf.twip.jmock.JMockExtension
All Implemented Interfaces:
TwipExtension

public class JMockExtension
extends java.lang.Object
implements TwipExtension

A TwipExtension that creates a JMock-Mockery and mocks all member variables of the test class that are annotated by Mock. If there is already a Mockery defined, use that. If it is just declared, but not initialized, do that.

This extension delegates to the JMockExtensionDelegate only if JMock is on the classpath.


Constructor Summary
JMockExtension()
           
 
Method Summary
 org.junit.runners.model.Statement wrap(boolean beforeSetup, org.junit.runners.model.FrameworkMethod method, java.lang.Object testInstance, org.junit.runners.model.Statement wrappedStatement)
          Decorate a JUnit Statement into a new one and thereby extend the functionality of JUnit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMockExtension

public JMockExtension()
Method Detail

wrap

public org.junit.runners.model.Statement wrap(boolean beforeSetup,
                                              org.junit.runners.model.FrameworkMethod method,
                                              java.lang.Object testInstance,
                                              org.junit.runners.model.Statement wrappedStatement)
Description copied from interface: TwipExtension
Decorate a JUnit Statement into a new one and thereby extend the functionality of JUnit. This method is called twice, first with beforeSetup == true, so the Statement you wrap is executed before the Befores are executed; this is what you'll want to initialize things. The second call is with beforeSetup == false, so the Statement you wrap is executed after the Afters are executed; this is what you'll want to verify things.

Specified by:
wrap in interface TwipExtension
Parameters:
beforeSetup - Will the wrapped statement be executed before the setup is done or thereafter?
method - The test method that is to be called.
testInstance - The test instance on which the method is called.
wrappedStatement - The Statement that you can wrap.
Returns:
a new Statement wrapping the one passed in; or directly that, if you choose not to wrap anything.


Copyright © 2010. All Rights Reserved.