本文整理匯總了Java中org.junit.rules.MethodRule.apply方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodRule.apply方法的具體用法?Java MethodRule.apply怎麽用?Java MethodRule.apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.rules.MethodRule
的用法示例。
在下文中一共展示了MethodRule.apply方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement result, final FrameworkMethod method, final Object target) {
Statement lastResult = result;
for (final MethodRule rule : getRules()) {
lastResult = rule.apply(lastResult, method, target);
}
return lastResult;
}
示例2: withRules
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
private Statement withRules( FrameworkMethod method, Object target, Statement statement )
{
Statement result = statement;
for( MethodRule each : rules( target ) )
result = each.apply( result, method, target );
return result;
}
示例3: withRules
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
/**
* method taken as is from BlockJUnit4ClassRunner 4.7 in order to preserve
* its functionality over following versions
*/
private Statement withRules(FrameworkMethod method, Object target,
Statement statement) {
Statement result = statement;
for (MethodRule each : rules(target)) {
result = each.apply(result, method, target);
}
return result;
}
示例4: apply
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
/**
* {@inheritDoc} Before evaluation of the base statement, the test instance
* will initialized.
*/
@Override
public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
Statement appliedStatement = base;
for (MethodRule rule : methodRuleChain) {
appliedStatement = rule.apply(appliedStatement, method, target);
}
return statement(appliedStatement, target);
}
示例5: withRules
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
/**
* Simply copied from BlockJUnit4ClassRunner, since its not accessible.
*/
private Statement withRules(FrameworkMethod method, Object target, Statement statement) {
Statement result = statement;
for (MethodRule each : getTestClass().getAnnotatedFieldValues(target, Rule.class,
MethodRule.class))
result = each.apply(result, method, target);
return result;
}
示例6: applyRuleToLastStatement
import org.junit.rules.MethodRule; //導入方法依賴的package包/類
protected Statement applyRuleToLastStatement(final Method method, final Object testInstance, Field field,
final LastRuleTestExecutorStatement lastStatement) throws IllegalAccessException {
MethodRule rule = (MethodRule) field.get(testInstance);
Statement statement = rule.apply(lastStatement, new FrameworkMethod(method), testInstance);
return statement;
}