Package org.junit.rules

Examples of org.junit.rules.TestRule.apply()


            if (fieldValue instanceof MethodRule) {
                // the MethodRule is known by junit 4.9 -> delegate to super-class
                statement = super.applyRuleToLastStatement(method, testInstance, field, lastStatement);
            } else if (fieldValue instanceof TestRule){
                TestRule rule = (TestRule) fieldValue;
                statement = rule.apply(lastStatement, description);
            } else {
                throw new IllegalStateException("Can only handle MethodRule and TestRule");
            }
            return statement;
        }
View Full Code Here


  public void intercept(final IMethodInvocation invocation) throws Throwable {
    Statement stat = createBaseStatement(invocation);

    for (FieldInfo field : ruleFields) {
      TestRule rule = (TestRule) getRuleInstance(field, invocation.getInstance());
      stat = rule.apply(stat, invocation.getIteration().getDescription());
    }

    stat.evaluate();
  }
}
View Full Code Here

  public void intercept(final IMethodInvocation invocation) throws Throwable {
    Statement stat = createBaseStatement(invocation);

    for (FieldInfo field : ruleFields) {
      TestRule rule = (TestRule) getRuleInstance(field, field.isShared() ? invocation.getSharedInstance() : invocation.getInstance());
      stat = rule.apply(stat, invocation.getSpec().getDescription());
    }

    stat.evaluate();
  }
}
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.