當前位置: 首頁>>代碼示例>>Java>>正文


Java TestRule.apply方法代碼示例

本文整理匯總了Java中org.junit.rules.TestRule.apply方法的典型用法代碼示例。如果您正苦於以下問題:Java TestRule.apply方法的具體用法?Java TestRule.apply怎麽用?Java TestRule.apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.rules.TestRule的用法示例。


在下文中一共展示了TestRule.apply方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: applyRuleToLastStatement

import org.junit.rules.TestRule; //導入方法依賴的package包/類
@Override
protected Statement applyRuleToLastStatement(final Method method, final Object testInstance, Field field,
        final LastRuleTestExecutorStatement lastStatement) throws IllegalAccessException {
    final Object fieldValue = field.get(testInstance);
    final Statement statement;
    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;
}
 
開發者ID:awenblue,項目名稱:powermock,代碼行數:17,代碼來源:PowerMockJUnit49RunnerDelegateImpl.java

示例2: apply

import org.junit.rules.TestRule; //導入方法依賴的package包/類
@Override
public Statement apply(Statement base, final Description description) {
  for (TestRule each : this.rules) {
    base = each.apply(base, description);
  }
  return base;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:8,代碼來源:RuleList.java

示例3: apply

import org.junit.rules.TestRule; //導入方法依賴的package包/類
/**
 * Takes all the rules in {@link #testRules()} and applies them to this Test Rule.
 * This is essential because the composite rule may depend on these rules being executed.
 */
@Override
public final Statement apply(Statement base, Description description) {
    base = innerResource.apply(base, description);

    for (TestRule each : testRules()) {
        base = each.apply(base, description);
    }

    return base;
}
 
開發者ID:graknlabs,項目名稱:grakn,代碼行數:15,代碼來源:CompositeTestRule.java

示例4: applyAll

import org.junit.rules.TestRule; //導入方法依賴的package包/類
private static Statement applyAll(Statement result, Iterable<TestRule> rules,
        Description description) {
    for (TestRule each : rules) {
        try {
            result = each.apply(result, description);
        } catch (Exception e) {
            // Rules don't make errors, you silly
        }
    }
    return result;
}
 
開發者ID:bishiboosh,項目名稱:junit-volkswagen,代碼行數:12,代碼來源:RunRules.java

示例5: apply

import org.junit.rules.TestRule; //導入方法依賴的package包/類
/**
 * @see TestRule#apply(org.junit.runners.model.Statement, org.junit.runner.
 *      Description)
 */
@Override
public Statement apply(final Statement base, final Description description) {

	JptRuleChain.description = description;

	Statement statement = base;

	for (final TestRule testRule : this.ruleListStartingWithInnerMost) {

		statement = testRule.apply(statement, description);
	}
	return statement;
}
 
開發者ID:gtcGroup,項目名稱:jped-parent-project,代碼行數:18,代碼來源:JptRuleChain.java

示例6: apply

import org.junit.rules.TestRule; //導入方法依賴的package包/類
public Statement apply(Statement base, Description description) {

    lookUpContainerSpecifics();
    TestRule containerSpecificRule = containerSpecifics.getTestRule(description.getTestClass());
    return containerSpecificRule.apply(base, description);
  }
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:7,代碼來源:TestContainerRule.java


注:本文中的org.junit.rules.TestRule.apply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。