当前位置: 首页>>代码示例>>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;未经允许,请勿转载。