类org.junit.rules.RunRules源码实例Demo

下面列出了怎么用org.junit.rules.RunRules的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: buck   文件: EndToEndRunner.java
private Statement withRules(EndToEndTestDescriptor child, Object target, Statement statement) {
  // We do not support MethodRules like the JUnit runner does as it has been functionally
  // replaced by TestRules (https://junit.org/junit4/javadoc/4.12/org/junit/rules/MethodRule.html)
  List<TestRule> testRules =
      getTestClass().getAnnotatedMethodValues(target, Rule.class, TestRule.class);
  testRules.addAll(getTestClass().getAnnotatedFieldValues(target, Rule.class, TestRule.class));
  return testRules.isEmpty()
      ? statement
      : new RunRules(statement, testRules, describeChild(child));
}
 
源代码2 项目: openCypher   文件: ParameterTest.java
/**
 * @see org.junit.runners.BlockJUnit4ClassRunner#withTestRules(FrameworkMethod, List, Statement)
 */
private Statement withTestRules( FrameworkMethod method, List<TestRule> testRules, Statement statement )
{
    return testRules.isEmpty() ? statement : new RunRules( statement, testRules, describeChild( method ) );
}
 
源代码3 项目: spectrum   文件: RuleContext.java
private Statement withTestRules(final List<TestRule> testRules, final Statement statement,
    final Description childDescription) {
  return testRules.isEmpty() ? statement : new RunRules(statement, testRules, childDescription);
}
 
源代码4 项目: spectrum   文件: RuleContext.java
private synchronized Statement withClassRules(final Statement base,
    final Description description) {
  List<TestRule> classRules = getClassRules();

  return classRules.isEmpty() ? base : new RunRules(base, classRules, description);
}
 
源代码5 项目: pinpoint   文件: PinpointPluginTestSuite.java
private Statement withClassRules(Statement statement) {
    List<TestRule> classRules = classRules();
    return classRules.isEmpty() ? statement :
            new RunRules(statement, classRules, getDescription());
}
 
源代码6 项目: htmlunit   文件: BrowserVersionClassRunner.java
/**
 * Returns a Statement.
 *
 * @param statement The base statement
 * @return a RunRules statement if any class-level Rule are found, or the base statement
 */
private Statement withTestRules(final FrameworkMethod method, final Object target, final Statement statement) {
    final List<TestRule> testRules = getTestRules(target);
    return testRules.isEmpty() ? statement : new RunRules(statement, testRules, describeChild(method));
}
 
源代码7 项目: rice   文件: LoadTimeWeavableTestRunner.java
/**
 * Returns a {@link org.junit.runners.model.Statement}: apply all
 * static fields assignable to {@link org.junit.rules.TestRule}
 * annotated with {@link org.junit.ClassRule}.
 *
 * @param statement the base statement
 * @return a RunRules statement if any class-level {@link org.junit.Rule}s are
 *         found, or the base statement
 */
private Statement withClassRules(Statement statement) {
    List<TestRule> classRules = classRules();
    return classRules.isEmpty() ? statement :
            new RunRules(statement, classRules, getDescription());
}
 
源代码8 项目: rice   文件: LoadTimeWeavableTestRunner.java
/**
 * Returns a {@link org.junit.runners.model.Statement}: apply all non-static value fields
 * annotated with {@link org.junit.Rule}.
 *
 * @param statement The base statement
 * @return a RunRules statement if any class-level {@link org.junit.Rule}s are
 *         found, or the base statement
 */
private Statement withTestRules(FrameworkMethod method, List<TestRule> testRules,
        Statement statement) {
    return testRules.isEmpty() ? statement :
            new RunRules(statement, testRules, describeChild(method));
}