Package org.junit.runners.model

Examples of org.junit.runners.model.Statement.evaluate()


         {
            new MultiStatementExecutor().execute
            (
                  new Statement() { public void evaluate() throws Throwable
                  {
                     statementWithAfters.evaluate();
                  }},
                  new Statement() { public void evaluate() throws Throwable
                  {
                     deployableTest.get().after(target, method.getMethod());
                  }}
View Full Code Here


                Throwable failureReason = null;

                final Retry retry = method.getAnnotation(Retry.class);
                if (retry == null) {
                    // Do a single test run attempt.
                    singleTryStatement.evaluate();
                } else {
                    final int numRetries = retry.value();

                    for (int i = 0; i < numRetries; ++i) {
                        try {
View Full Code Here

                    final int numRetries = retry.value();

                    for (int i = 0; i < numRetries; ++i) {
                        try {
                            // Do a single test run attempt.
                            singleTryStatement.evaluate();
                            // Attempt succeeded, stop evaluation here.
                            return;
                        } catch (Throwable t) {
                            // Attempt failed, store the reason.
                            failureReason = t;
View Full Code Here

          final Statement statement= super.methodBlock(method);
          return new Statement() {
            @Override
            public void evaluate() throws Throwable {
              try {
                statement.evaluate();
                handleDataPointSuccess();
              } catch (AssumptionViolatedException e) {
                handleAssumptionViolation(e);
              } catch (Throwable e) {
                reportParameterizedError(e, complete
View Full Code Here

            @Override
            public void evaluate() throws Throwable {
                checkClassDependencies();
                notifier.addListener(listener);
                try {
                    stmt.evaluate();
                } finally {
                    notifier.removeListener(listener);
                }
            }
        };
View Full Code Here

  @Test
  public void runsTestsStatement() throws Throwable {
    IntrospectingStatement base = new IntrospectingStatement();
    Statement finalStatement = rule.apply(base, ANY_METHOD, ANY_TARGET);
   
    finalStatement.evaluate();
   
    assertThat(base.invoked(), is(true));
  }

  @Test
View Full Code Here

      allowing(server).isSatisfied(with(any(Description.class)));
        will(returnValue(true));
      oneOf(server).stop();
    }});
   
    finalStatement.evaluate();
  }

  @Test
  public void assertsServersAfterRunningTest() throws Throwable {
    Statement finalStatement = rule.apply(anyStatement(), ANY_METHOD, testClassWith(server));
View Full Code Here

      oneOf(server).isSatisfied(with(any(Description.class)));
        will(returnValue(true));
      allowing(server).stop();
    }});
   
    finalStatement.evaluate();
  }

  @Test
  public void shutsdownServersAfterFailingTest() throws Throwable {
    Statement finalStatement = rule.apply(new Statement() {
View Full Code Here

        will(returnValue(true));
      oneOf(server).stop();
    }});
   
    try {
      finalStatement.evaluate();
      fail("Expected assertion error");
    } catch (AssertionError e) { }
  }

  @Test
View Full Code Here

        will(returnValue(true));
      oneOf(server).stop();
    }});
   
    try {
      finalStatement.evaluate();
      fail("Expected exception");
    } catch (RuntimeException e) { }
  }
 
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.