微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.junit.internal.builders.IgnoredClassRunner的实例源码

项目:aaf-junit    文件ConcurrentDependsOnClasspathSuite.java   
public ConcurrentDependsOnClasspathSuite(Class<?> suiteClass,RunnerBuilder builder) throws InitializationError {
    super(suiteClass,builder);
    methodFilter = newMethodFilter(suiteClass.getAnnotation(MethodFilters.class));
    int maximumPoolSize = isAnnotationPresent(suiteClass) && !runSerial() ? maximumPoolSize(suiteClass) : 1;
    if (maximumPoolSize < 1) {
        throw new IllegalArgumentException("maximumPoolSize < 1");
    }
    scheduler = new ConcurrentDependsOnSuiteScheduler(maximumPoolSize,listener);
    setScheduler(scheduler);
    getChildren().stream().forEach(r -> shouldRun.add(getClassName(r)));
    getChildren().stream().forEach(r -> nametoRunner.put(getClassName(r),r));
    verifyDependecyGraph();
    getChildren().stream().filter(r -> r instanceof IgnoredClassRunner).forEach(r -> {
        Failed.add(getClassName(r));
    });
    if (methodFilter != null) {
        applyMethodFilter();
    }
}
项目:xtext-core    文件RunnerBuilder.java   
@Override
protected IgnoredBuilder ignoredBuilder() {
    return new IgnoredBuilder() {
        @Override
        public Runner runnerForClass(Class<?> testClass) {
            if (testClass.getAnnotation(Ignore.class) != null || testClass.getAnnotation(IgnoredBySmokeTest.class) != null)
                return new IgnoredClassRunner(testClass);
            return null;
        }
    };
}
项目:aaf-junit    文件ConcurrentDependsOnClasspathSuite.java   
@Override
protected void runchild(Runner runner,@SuppressWarnings("hiding") RunNotifier notifier) {
    if (shouldIgnore(runner)) {
        Failed.add(getClassName(runner));
        super.runchild(
                scheduler.newClassRunner(getClassName(runner),new IgnoredClassRunner(runner.getDescription().getTestClass()),methodFilter),notifier);
        runner.getDescription().getChildren().stream().forEach(t -> notifier.fireTestIgnored(t));
    } else {
        super.runchild(scheduler.newClassRunner(getClassName(runner),runner,notifier);
    }
}
项目:aaf-junit    文件ConcurrentDependsOnClasspathSuite.java   
private void verifyAllMethodExists(@SuppressWarnings("hiding") Runner r) {
    if (r instanceof IgnoredClassRunner) {
        return;
    }

    List<String> classMethods = r.getDescription().getChildren().stream().map(d -> d.getmethodName()).collect(Collectors.toList());
    for (String m : filter.methods) {
        if (!classMethods.contains(m)) {
            System.err.println("method '" + m + "' is filtered by " + MethodFilter.class.getSimpleName()
                    + " but does not exist in class '" + className + "'");
        }
    }
}
项目:junit-servers    文件RunIfRunner.java   
/**
 * Create the runner.
 *
 * @param klass The test class.
 * @throws InitializationError If the test class is malformed.
 */
public RunIfRunner(Class<?> klass) throws InitializationError {
    boolean ignoreClass = RunIfUtils.isIgnored(klass);

    // If the entire test class must be ignored,we instantiate an instance of IgnoredClassRunner
    // since this runner will not instantiate the test class,thus allowing the class to use
    // illegal API such as Java8 method on JDK7 (since it will never be evaluated).
    this.delegate = ignoreClass ? new IgnoredClassRunner(klass) : new RunIfBlockJunit4ClassRunner(klass);
}
项目:sql-layer    文件NamedParameterizedRunner.java   
@SuppressWarnings("unused") // Invoked by reflection
public NamedParameterizedRunner(Class<?> klass) throws Throwable
   {
       super(klass,Collections.<Runner>emptyList());

       if (getTestClass().getJavaClass().getAnnotation(Ignore.class) != null)
       {
           runners = Collections.unmodifiableList(Arrays.asList((Runner)new IgnoredClassRunner(klass)));
           return;
       }

       List<Runner> localRunners = new LinkedList<>();

       Collection<Parameterization> parameterizations = getParameterizations();
       checkFailingParameterizations(parameterizations);

       final String override = System.getProperty(ParaMETERIZATION_OVERRIDE);
       final boolean overrideIsRegex = (override != null) && paramNameUsesRegex(override);
       if (override != null)
       {
           String msg = "Override is set to";
           if (overrideIsRegex)
           {
               msg += " regex";
           }
           msg += ":" + override;
           logger.debug(msg);
       }
       for (Parameterization param : parameterizations)
       {
           final boolean useThisParam;
           if (override == null)
           {
               useThisParam = true;
           }
           else if (overrideIsRegex)
           {
               useThisParam = paramNameMatchesRegex(param.getName(),override);
           }
           else
           {
               useThisParam = param.getName().equals(override);
           }
           if (useThisParam)
           {
               if (override != null)
               {
                   logger.debug("Adding parameterization: " + param.getName());
               }
               localRunners.add(new ReifiedParamRunner(getTestClass().getJavaClass(),param,override != null));
           }
       }
       runners = Collections.unmodifiableList(localRunners);
   }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。