Package org.junit.runners.model

Examples of org.junit.runners.model.Statement


        return "unknown-test-class";
    }

    public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
        init(method, target);
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                base.evaluate();
                getDir().maybeDeleteDir();
                // Don't delete on failure
View Full Code Here


public class OpenApiFixture implements MethodRule {
    private GradleDistribution dist;
    private final List<JFrame> frames = new ArrayList<JFrame>();

    public Statement apply(final Statement base, FrameworkMethod method, final Object target) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                dist = RuleHelper.getField(target, GradleDistribution.class);
                try {
                    base.evaluate();
View Full Code Here

    public TestFile getDir() {
        return temporaryFolder.getDir();
    }

    public Statement apply(Statement base, final FrameworkMethod method, Object target) {
        final Statement statement = resources.apply(base, method, target);
        temporaryFolder = findTempDir(target);
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                String className = method.getMethod().getDeclaringClass().getSimpleName();
                maybeCopy(String.format("%s/shared", className));
                maybeCopy(String.format("%s/%s", className, method.getName()));
                for (String extraResource : extraResources) {
                    maybeCopy(extraResource);
                }
                statement.evaluate();
            }
        };
    }
View Full Code Here

     * @see org.junit.runners.ParentRunner#withBeforeClasses(org.junit.runners.model.Statement)
     */
    @Override
    protected Statement withBeforeClasses(Statement statement)
    {
        Statement result = super.withBeforeClasses(statement);
        List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(BeforeSuite.class);
        if (methods.isEmpty()) {
            return result;
        }
        return new RunBefores(result, methods, null);
View Full Code Here

     * @see org.junit.runners.ParentRunner#withAfterClasses(org.junit.runners.model.Statement)
     */
    @Override
    protected Statement withAfterClasses(Statement statement)
    {
        Statement result = super.withAfterClasses(statement);
        List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(AfterSuite.class);
        if (methods.isEmpty()) {
            return result;
        }
        return new RunAfters(result, methods, null);
View Full Code Here

* {@link RuleChain} to guarantee the order of execution.
*/
abstract class AbstractBeforeAfterRule implements TestRule {
  @Override
  public Statement apply(final Statement s, final Description d) {
    return new Statement() {
      @Override
      public void evaluate() throws Throwable {
        final ArrayList<Throwable> errors = new ArrayList<Throwable>();

        try {
View Full Code Here

        return getTestClass().getAnnotatedMethods(PerformanceTest.class);
    }

    @Override
    protected Statement methodInvoker(FrameworkMethod method, Object test) {
        Statement methodInvoker = super.methodInvoker(method, test);

        Statement invokeWarmUp = methodInvoker;

        invokeWarmUp = withWarmUpIterationStartedEvents(method, test, invokeWarmUp);
        invokeWarmUp = withWarmUpIterationFinishedEvents(method, test, invokeWarmUp);
        invokeWarmUp = withBeforeWarmUpIterations(method, test, invokeWarmUp);
        invokeWarmUp = withAfterWarmUpIterations(method, test, invokeWarmUp);
        invokeWarmUp = withWarmUpIterations(method, test, invokeWarmUp);
        invokeWarmUp = withWarmUpStartedEvents(method, test, invokeWarmUp);
        invokeWarmUp = withWarmUpFinishedEvents(method, test, invokeWarmUp);
        invokeWarmUp = withBeforeWarmUps(method, test, invokeWarmUp);
        invokeWarmUp = withAfterWarmUps(method, test, invokeWarmUp);

        Statement invokePerformanceTest = methodInvoker;

        invokePerformanceTest = withExecutionIterationStartedEvents(method, test, invokePerformanceTest);
        invokePerformanceTest = withExecutionIterationFinishedEvents(method, test, invokePerformanceTest);
        invokePerformanceTest = withBeforePerformanceIterations(method, test, invokePerformanceTest);
        invokePerformanceTest = withAfterPerformanceIterations(method, test, invokePerformanceTest);
View Full Code Here

    public Service(Class<?> serviceClass) {
        this.serviceClass = serviceClass;
    }

    public Statement apply(final Statement base, final Description description) {
        return new Statement() {

            @Override
            public void evaluate() throws Throwable {
                final BundleContext bundleContext = Activator.getBundleContext();
View Full Code Here

    /** Evaluate our base statement once for every instance.
     *  Tests can use our getSlingInstance() method to access the current one.
     *  See MultipleOsgiConsoleTest example in the samples integration tests module.
     */
    public Statement apply(final Statement base, Description dest) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                for(SlingInstance instance : instances) {
                    currentInstance = instance;
                    base.evaluate();
View Full Code Here

        .append(" msec")
        .toString();
    }
   
    public Statement apply(final Statement statement, final Description description) {
        return new Statement() {
           
            private Throwable eval(Statement stmt) {
                try {
                    stmt.evaluate();
                } catch(Throwable t) {
View Full Code Here

TOP

Related Classes of org.junit.runners.model.Statement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.