Search in sources :

Example 1 with AssertNoRunningJobsStatement

use of org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement in project scout.rt by eclipse.

the class PlatformTestRunner method classBlock.

@Override
protected Statement classBlock(final RunNotifier notifier) {
    final Statement s4 = super.classBlock(notifier);
    final Statement s3 = new RunContextStatement(s4, new IRunContextProvider() {

        @Override
        public RunContext create() {
            return createJUnitRunContext();
        }
    });
    final Statement s2 = new AssertNoRunningJobsStatement(s3, "Test class");
    final Statement s1 = new PlatformStatement(s2, ReflectionUtility.getAnnotation(RunWithNewPlatform.class, getTestClass().getJavaClass()));
    return s1;
}
Also used : IRunContextProvider(org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement.IRunContextProvider) Statement(org.junit.runners.model.Statement) SubjectStatement(org.eclipse.scout.rt.testing.platform.runner.statement.SubjectStatement) BeanAnnotationsCleanupStatement(org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsCleanupStatement) AssertNoRunningJobsStatement(org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement) TimeoutRunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimeoutRunContextStatement) BeanAnnotationsInitStatement(org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsInitStatement) RegisterBeanStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RegisterBeanStatement) ThrowHandledExceptionStatement(org.eclipse.scout.rt.testing.platform.runner.statement.ThrowHandledExceptionStatement) ClearThreadInterruptionStatusStatement(org.eclipse.scout.rt.testing.platform.runner.statement.ClearThreadInterruptionStatusStatement) RunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement) PlatformStatement(org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement) TransactionAddFailureOnAnyExceptionStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TransactionAddFailureOnAnyExceptionStatement) TimesStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement) TimeoutRunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimeoutRunContextStatement) RunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement) RunContext(org.eclipse.scout.rt.platform.context.RunContext) AssertNoRunningJobsStatement(org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement) PlatformStatement(org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement)

Example 2 with AssertNoRunningJobsStatement

use of org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement 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;
}
Also used : SubjectStatement(org.eclipse.scout.rt.testing.platform.runner.statement.SubjectStatement) TimesStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) Statement(org.junit.runners.model.Statement) SubjectStatement(org.eclipse.scout.rt.testing.platform.runner.statement.SubjectStatement) BeanAnnotationsCleanupStatement(org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsCleanupStatement) AssertNoRunningJobsStatement(org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement) TimeoutRunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimeoutRunContextStatement) BeanAnnotationsInitStatement(org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsInitStatement) RegisterBeanStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RegisterBeanStatement) ThrowHandledExceptionStatement(org.eclipse.scout.rt.testing.platform.runner.statement.ThrowHandledExceptionStatement) ClearThreadInterruptionStatusStatement(org.eclipse.scout.rt.testing.platform.runner.statement.ClearThreadInterruptionStatusStatement) RunContextStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement) PlatformStatement(org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement) TransactionAddFailureOnAnyExceptionStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TransactionAddFailureOnAnyExceptionStatement) TimesStatement(org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement) RegisterBeanStatement(org.eclipse.scout.rt.testing.platform.runner.statement.RegisterBeanStatement) ClearThreadInterruptionStatusStatement(org.eclipse.scout.rt.testing.platform.runner.statement.ClearThreadInterruptionStatusStatement) AssertNoRunningJobsStatement(org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement)

Aggregations

AssertNoRunningJobsStatement (org.eclipse.scout.rt.testing.platform.runner.statement.AssertNoRunningJobsStatement)2 BeanAnnotationsCleanupStatement (org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsCleanupStatement)2 BeanAnnotationsInitStatement (org.eclipse.scout.rt.testing.platform.runner.statement.BeanAnnotationsInitStatement)2 ClearThreadInterruptionStatusStatement (org.eclipse.scout.rt.testing.platform.runner.statement.ClearThreadInterruptionStatusStatement)2 PlatformStatement (org.eclipse.scout.rt.testing.platform.runner.statement.PlatformStatement)2 RegisterBeanStatement (org.eclipse.scout.rt.testing.platform.runner.statement.RegisterBeanStatement)2 RunContextStatement (org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement)2 SubjectStatement (org.eclipse.scout.rt.testing.platform.runner.statement.SubjectStatement)2 ThrowHandledExceptionStatement (org.eclipse.scout.rt.testing.platform.runner.statement.ThrowHandledExceptionStatement)2 TimeoutRunContextStatement (org.eclipse.scout.rt.testing.platform.runner.statement.TimeoutRunContextStatement)2 TimesStatement (org.eclipse.scout.rt.testing.platform.runner.statement.TimesStatement)2 TransactionAddFailureOnAnyExceptionStatement (org.eclipse.scout.rt.testing.platform.runner.statement.TransactionAddFailureOnAnyExceptionStatement)2 Statement (org.junit.runners.model.Statement)2 BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)1 RunContext (org.eclipse.scout.rt.platform.context.RunContext)1 IRunContextProvider (org.eclipse.scout.rt.testing.platform.runner.statement.RunContextStatement.IRunContextProvider)1