use of org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement in project scout.rt by eclipse.
the class PlatformTestRunner method interceptMethodLevelStatement.
/**
* Overwrite this method to contribute some 'method-level' behavior to this Runner.
* <p>
* Contributions are plugged according to the design pattern: 'chain-of-responsibility' - it is easiest to read the
* chain from 'bottom-to-top'.
* <p>
* To contribute on top of the chain (meaning that you are invoked <strong>after</strong> the contributions of super
* classes and therefore can base on their contributed functionality), you can use constructions of the following
* form:
* <p>
* <code>
* Statement s2 = new YourInterceptor2(<strong>next</strong>); // executed 3th<br/>
* Statement s1 = new YourInterceptor1(s2); // executed 2nd<br/>
* Statement head = <i>super.interceptMethodLevelStatement(s1)</i>; // executed 1st<br/>
* return head;
* </code>
* </p>
* To be invoked <strong>before</strong> the super class contributions, you can use constructions of the following
* form:
* <p>
* <code>
* Statement s2 = <i>super.interceptMethodLevelStatement(<strong>next</strong>)</i>; // executed 3th<br/>
* Statement s1 = new YourInterceptor2(s2); // executed 2nd<br/>
* Statement head = new YourInterceptor1(s1); // executed 1st<br/>
* return head;
* </code>
*
* @param next
* subsequent {@link Statement}.
* @return the head of the chain to be invoked first.
*/
protected Statement interceptMethodLevelStatement(final Statement next, final Class<?> testClass, final Method testMethod) {
final Statement s5 = new ClearThreadInterruptionStatusStatement(next);
final Statement s4 = new SubjectStatement(s5, ReflectionUtility.getAnnotation(RunWithSubject.class, testMethod, testClass));
// exception handler to not silently swallow handled exceptions.
final Statement s3 = new RegisterBeanStatement(s4, new BeanMetaData(JUnitExceptionHandler.class).withReplace(true).withOrder(-1000));
final Statement s2 = new AssertNoRunningJobsStatement(s3, "Test method");
final Statement s1 = new TimesStatement(s2, ReflectionUtility.getAnnotation(Times.class, testMethod, testClass));
return s1;
}
Aggregations