Java 类org.junit.internal.builders.AllDefaultPossibilitiesBuilder 实例源码

项目:intellij-ce-playground    文件:JUnit46ClassesRequestBuilder.java   
private static List collectWrappedRunners(Class[] classes) throws InitializationError {
  final List runners = new ArrayList();
  final List nonSuiteClasses = new ArrayList();
  final SuiteMethodBuilder suiteMethodBuilder = new SuiteMethodBuilder();
  for (int i = 0, length = classes.length; i < length; i++) {
    Class aClass = classes[i];
    if (suiteMethodBuilder.hasSuiteMethod(aClass)) {
      try {
        runners.add(new ClassAwareSuiteMethod(aClass));
      }
      catch (Throwable throwable) {
        runners.add(new ErrorReportingRunner(aClass, throwable));
      }
    } else {
      nonSuiteClasses.add(aClass);
    }
  }
  runners.addAll(new AllDefaultPossibilitiesBuilder(false).runners(null, (Class[])nonSuiteClasses.toArray(new Class[nonSuiteClasses.size()])));
  return runners;
}
项目:tools-idea    文件:JUnit46ClassesRequestBuilder.java   
public static Request getClassesRequest(final String suiteName, Class[] classes, Map classMethods) {
  boolean canUseSuiteMethod = canUseSuiteMethod(classMethods);
  try {
    final Runner suite;
    if (canUseSuiteMethod) {
      suite = new IdeaSuite(collectWrappedRunners(classes), suiteName);
    } else {
      final AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder(canUseSuiteMethod);
      suite = new IdeaSuite(builder, classes, suiteName);
    }
    return Request.runner(suite);
  }
  catch (InitializationError e) {
    throw new RuntimeException(e);
  }
}
项目:tools-idea    文件:JUnit46ClassesRequestBuilder.java   
private static List collectWrappedRunners(Class[] classes) throws InitializationError {
  final List runners = new ArrayList();
  final List nonSuiteClasses = new ArrayList();
  final SuiteMethodBuilder suiteMethodBuilder = new SuiteMethodBuilder();
  for (int i = 0, length = classes.length; i < length; i++) {
    Class aClass = classes[i];
    if (suiteMethodBuilder.hasSuiteMethod(aClass)) {
      try {
        runners.add(new ClassAwareSuiteMethod(aClass));
      }
      catch (Throwable throwable) {
        runners.add(new ErrorReportingRunner(aClass, throwable));
      }
    } else {
      nonSuiteClasses.add(aClass);
    }
  }
  runners.addAll(new AllDefaultPossibilitiesBuilder(false).runners(null, (Class[])nonSuiteClasses.toArray(new Class[nonSuiteClasses.size()])));
  return runners;
}
项目:statechum    文件:ParameterizedSuite.java   
/**
 * Only called reflectively. Do not use programmatically.
 */
public ParameterizedSuite(Class<?> klass) throws Throwable 
{
    super(klass, Collections.<Runner>emptyList());

    RunnerBuilder builder = new AllDefaultPossibilitiesBuilder(true);
    List<Object[]> parametersList= ParameterizedWithName.getParametersList(getTestClass());



    for (int i= 0; i < parametersList.size(); i++)
    {
        Object [] parameters = null;
        try {
            parameters = parametersList.get(i);
        } catch (ClassCastException e) {
            throw new Exception(String.format("%s.%s() must return a Collection of arrays.",getTestClass().getName(), ParameterizedWithName.getParametersMethod(getTestClass()).getName()));
        }


        String parameterDescr = ParameterizedWithName.TestClassRunnerForParameters.obtainStringDescription(getTestClass().getJavaClass(),parameters);
        Suite testSuite = new SuiteRunnerWithParameters(getTestClass().getJavaClass(), builder, parameterDescr,getTestClass().getOnlyConstructor().newInstance(parameters));
        runners.add(testSuite);
        //List<Runner> runnersToAdd = new org.junit.runners.Suite(klass,builder).getChildren();
        //runnerForParameters.addTestRunner(runnersToAdd);
    }
}
项目:sosiefier    文件:ClassRequest.java   
@Override
public Runner getRunner() {
    if (fRunner == null) {
        synchronized (fRunnerLock) {
            if (fRunner == null) {
                fRunner = new AllDefaultPossibilitiesBuilder(fCanUseSuiteMethod).safeRunnerForClass(fTestClass);
            }
        }
    }
    return fRunner;
}
项目:lcm    文件:ClassRequest.java   
@Override
public Runner getRunner() {
    synchronized (fRunnerLock) {
        if (fRunner == null) {
            fRunner = new AllDefaultPossibilitiesBuilder(fCanUseSuiteMethod).safeRunnerForClass(fTestClass);
        }
        return fRunner;
    }
}
项目:junit    文件:ClassRequest.java   
@Override
public Runner getRunner() {
    synchronized (fRunnerLock) {
        if (fRunner == null) {
            fRunner = new AllDefaultPossibilitiesBuilder(fCanUseSuiteMethod).safeRunnerForClass(fTestClass);
        }
        return fRunner;
    }
}
项目:org.openntf.domino    文件:ClassRequest.java   
@Override
public Runner getRunner() {
    synchronized (fRunnerLock) {
        if (fRunner == null) {
            fRunner = new AllDefaultPossibilitiesBuilder(fCanUseSuiteMethod).safeRunnerForClass(fTestClass);
        }
        return fRunner;
    }
}
项目:commons-test    文件:ConcurrentSuite.java   
public ConcurrentSuite(final Class<?> klass) throws InitializationError {
    super(klass, new AllDefaultPossibilitiesBuilder(true) {
        @Override
        public Runner runnerForClass(Class<?> testClass) throws Throwable {
            List<RunnerBuilder> builders = Arrays.asList(
                    new RunnerBuilder() {
                        @Override
                        public Runner runnerForClass(Class<?> testClass2) throws Throwable {
                            Concurrent annotation = testClass2.getAnnotation(Concurrent.class);
                            if (annotation != null)
                                return new ConcurrentJunitRunner(testClass2);
                            return null;
                        }
                    },
                    ignoredBuilder(),
                    annotatedBuilder(),
                    suiteMethodBuilder(),
                    junit3Builder(),
                    junit4Builder());
            for (RunnerBuilder each : builders) {
                Runner runner = each.safeRunnerForClass(testClass);
                if (runner != null)
                    return runner;
            }
            return null;
        }
    });
    setScheduler(new RunnerScheduler() {
        ExecutorService executorService = Executors.newFixedThreadPool(
                klass.isAnnotationPresent(Concurrent.class) ?
                        klass.getAnnotation(Concurrent.class).threads() :
                        (int) (Runtime.getRuntime().availableProcessors() * 1.5),
                new NamedThreadFactory(klass.getSimpleName()));
        CompletionService<Void> completionService = new ExecutorCompletionService<>(executorService);
        Queue<Future<Void>> tasks = new LinkedList<>();

        @Override
        public void schedule(Runnable childStatement) {
            tasks.offer(completionService.submit(childStatement, null));
        }

        @Override
        public void finished() {
            try {
                while (!tasks.isEmpty())
                    tasks.remove(completionService.take());
            } catch (@SuppressWarnings("unused") InterruptedException e) {
                Thread.currentThread().interrupt();
            } finally {
                while (!tasks.isEmpty())
                    tasks.poll().cancel(true);
                executorService.shutdownNow();
            }
        }
    });
}
项目:pitest    文件:AdaptedJUnitTestUnit.java   
private static RunnerBuilder createRunnerBuilder() {
  return new AllDefaultPossibilitiesBuilder(true);
}
项目:easy-test    文件:EasySuite.java   
/**
 * Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
 *
 * @param klass        the root of the suite
 * @param suiteClasses the classes in the suite
 */
protected EasySuite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {

    this(new AllDefaultPossibilitiesBuilder(true), klass, suiteClasses);
}
项目:sosiefier    文件:Suite.java   
/**
 * Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
 *
 * @param klass the root of the suite
 * @param suiteClasses the classes in the suite
 */
protected Suite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
    this(new AllDefaultPossibilitiesBuilder(true), klass, suiteClasses);
}
项目:lcm    文件:Suite.java   
/**
 * Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
 *
 * @param klass the root of the suite
 * @param suiteClasses the classes in the suite
 */
protected Suite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
    this(new AllDefaultPossibilitiesBuilder(true), klass, suiteClasses);
}
项目:junit    文件:Suite.java   
/**
 * Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
 *
 * @param klass the root of the suite
 * @param suiteClasses the classes in the suite
 */
protected Suite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
    this(new AllDefaultPossibilitiesBuilder(true), klass, suiteClasses);
}
项目:org.openntf.domino    文件:Suite.java   
/**
 * Call this when the default builder is good enough. Left in for compatibility with JUnit 4.4.
 *
 * @param klass the root of the suite
 * @param suiteClasses the classes in the suite
 */
protected Suite(Class<?> klass, Class<?>[] suiteClasses) throws InitializationError {
    this(new AllDefaultPossibilitiesBuilder(true), klass, suiteClasses);
}