use of org.junit.internal.builders.AllDefaultPossibilitiesBuilder in project intellij-community by JetBrains.
the class JUnit46ClassesRequestBuilder method collectWrappedRunners.
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;
}
use of org.junit.internal.builders.AllDefaultPossibilitiesBuilder in project component-runtime by Talend.
the class MultiEnvironmentsRunnerTest method run.
@org.junit.jupiter.api.Test
void run() throws Throwable {
STEPS.clear();
new AllDefaultPossibilitiesBuilder(true).runnerForClass(TheTestModel.class).run(new RunNotifier());
assertEquals(asList("start>E1", "test1", "test2", "stop>E1", "start>E2", "test1", "test2", "stop>E2"), STEPS);
}
use of org.junit.internal.builders.AllDefaultPossibilitiesBuilder in project intellij-community by JetBrains.
the class JUnit46ClassesRequestBuilder method getClassesRequest.
public static Request getClassesRequest(final String suiteName, Class[] classes, Map classMethods, Class category) {
boolean canUseSuiteMethod = canUseSuiteMethod(classMethods);
try {
if (category != null) {
try {
Class.forName("org.junit.experimental.categories.Categories");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Categories are not available");
}
}
Runner suite;
if (canUseSuiteMethod) {
try {
Class.forName("org.junit.experimental.categories.Categories");
suite = new IdeaSuite48(collectWrappedRunners(classes), suiteName, category);
} catch (ClassNotFoundException e) {
suite = new IdeaSuite(collectWrappedRunners(classes), suiteName);
}
} else {
final AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder(canUseSuiteMethod);
try {
Class.forName("org.junit.experimental.categories.Categories");
suite = new IdeaSuite48(builder, classes, suiteName, category);
} catch (ClassNotFoundException e) {
suite = new IdeaSuite(builder, classes, suiteName);
}
}
return Request.runner(suite);
} catch (InitializationError e) {
throw new RuntimeException(e);
}
}
use of org.junit.internal.builders.AllDefaultPossibilitiesBuilder in project junit4 by junit-team.
the class Request method classes.
/**
* Create a <code>Request</code> that, when processed, will run all the tests
* in a set of classes.
*
* @param computer Helps construct Runners from classes
* @param classes the classes containing the tests
* @return a <code>Request</code> that will cause all tests in the classes to be run
*/
public static Request classes(Computer computer, Class<?>... classes) {
try {
AllDefaultPossibilitiesBuilder builder = new AllDefaultPossibilitiesBuilder();
Runner suite = computer.getSuite(builder, classes);
return runner(suite);
} catch (InitializationError e) {
return runner(new ErrorReportingRunner(e, classes));
}
}
use of org.junit.internal.builders.AllDefaultPossibilitiesBuilder in project component-runtime by Talend.
the class DelegatingRunnerTest method run.
@Test
void run() throws Throwable {
MyRunner.STEPS.clear();
new AllDefaultPossibilitiesBuilder(true).runnerForClass(TheTestModel.class).run(new RunNotifier());
assertEquals(asList("constructor>" + TheTestModel.class.getName(), "run"), MyRunner.STEPS);
}
Aggregations