View Javadoc

1   package net.sf.twip;
2   
3   import org.junit.runners.model.*;
4   
5   /**
6    * Allows to wrap a JUnit- {@link Statement} {@link #wrapInner(FrameworkMethod, Object, Statement)
7    * before} or {@link #wrapOuter(FrameworkMethod, Object, Statement) after} the execution of other
8    * setup code.
9    * 
10   * @see TwipExtensions
11   */
12  public abstract class TwipExtension {
13  
14  	/**
15  	 * Decorate a JUnit {@link Statement} into a new one and thereby extend the functionality of
16  	 * JUnit. Your Statement is executed directly around the method call itself.
17  	 * 
18  	 * @param method
19  	 *            The test method that is to be called.
20  	 * @param testInstance
21  	 *            The test instance on which the method is called.
22  	 * @param statement
23  	 *            The {@link Statement} that you can wrap.
24  	 * @return a new {@link Statement} wrapping the one passed in; or directly that, if you choose
25  	 *         not to wrap anything.
26  	 */
27  	public Statement wrapInner(FrameworkMethod method, Object testInstance, Statement statement) {
28  		return statement;
29  	}
30  
31  	/**
32  	 * Decorate a JUnit {@link Statement} into a new one and thereby extend the functionality of
33  	 * JUnit. Your Statement is executed around all the other setups/teardowns.
34  	 * 
35  	 * @param method
36  	 *            The test method that is to be called.
37  	 * @param testInstance
38  	 *            The test instance on which the method is called.
39  	 * @param statement
40  	 *            The {@link Statement} that you can wrap.
41  	 * @return a new {@link Statement} wrapping the one passed in; or directly that, if you choose
42  	 *         not to wrap anything.
43  	 */
44  	public Statement wrapOuter(FrameworkMethod method, Object testInstance, Statement statement) {
45  		return statement;
46  	}
47  }