本文整理汇总了Java中org.junit.runners.model.RunnerBuilder类的典型用法代码示例。如果您正苦于以下问题:Java RunnerBuilder类的具体用法?Java RunnerBuilder怎么用?Java RunnerBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RunnerBuilder类属于org.junit.runners.model包,在下文中一共展示了RunnerBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConcurrentDependsOnClasspathSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
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();
}
}
示例2: CustomRunner
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public CustomRunner(Class<?> klass, RunnerBuilder builder) throws InitializationError {
super(
klass,
new RunnerBuilder() {
@Override public Runner runnerForClass(Class<?> testClass) throws Throwable {
Boolean oldValue = IS_FAST_TEST_SUITE_ACTIVE.get();
try {
IS_FAST_TEST_SUITE_ACTIVE.set(true);
Runner r = builder.runnerForClass(testClass);
return r;
} finally {
IS_FAST_TEST_SUITE_ACTIVE.set(oldValue);
}
}
}
);
}
示例3: ParameterizedSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public ParameterizedSuite(Class<?> suiteTestClass, RunnerBuilder runnerBuilder) throws Throwable {
super(suiteTestClass);
Class<?>[] childTestClasses = SuiteUtil.getSuiteClasses(suiteTestClass);
mode = determineRuntimeMode();
if (Mode.ROOT.equals(mode)) {
// Forking for each parameter is necessary.
Iterable<Object> parametersOfSuiteClass = ParameterizedUtil.getParameters(getTestClass());
String parametersNamePattern = ParameterizedUtil.getNamePatternForParameters(getTestClass());
currentlyActiveParameter = null;
this.runners = createSuiteRunnersPerParameter(suiteTestClass, runnerBuilder, childTestClasses, parametersOfSuiteClass, parametersNamePattern);
} else {
// Forking has already been done by a ParameterizedSuite that is superior in the test
// hierarchy. Create Runners for children like a normal Suite would do.
currentlyActiveParameter = ParameterContext.getParameterAsArray();
this.runners = createRunnersForChildTestClasses(suiteTestClass, runnerBuilder, childTestClasses);
}
}
示例4: getRunners
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
@Synchronized
private static List<Runner> getRunners(@NonNull Class<?> suiteClass, @NonNull RunnerBuilder builder)
throws InitializationError {
List<Runner> runners = RUNNERS_CACHE.get(suiteClass);
if (runners == null) {
final List<Class<?>> testClasses = resolveTestClasses(suiteClass);
runners = Collections.unmodifiableList(builder.runners(suiteClass, testClasses));
RUNNERS_CACHE.put(suiteClass, runners);
TEST_CLASSES_CACHE.put(suiteClass, testClasses);
}
return runners;
}
示例5: createSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
private void createSuite(Class<?> suiteClass) throws Exception {
suite = new XTFTestSuite(suiteClass, new RunnerBuilder() {
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
return new BlockJUnit4ClassRunner(testClass);
}
});
}
示例6: SuiteForSingleParameter
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public SuiteForSingleParameter(RunnerBuilder runnerBuilder, Class<?> forkingSuiteClass, Class<?>[] classes,
String suiteName, Object[] parameter) throws InitializationError {
/*
* By passing "forkingSuiteClass" (which is the forking
* ParameterizedSuite), the JUnit framework will build the internal
* testClass attribute from the ParameterizedSuite and not from this
* virtual, forked Suite. This way @Before/After/Class can be evaluated.
*/
super(runnerBuilder, forkingSuiteClass, classes);
this.suiteName = suiteName;
this.singleParameter = parameter;
}
示例7: setContextAndBuildSuiteForSingleParameter
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
private SuiteForSingleParameter setContextAndBuildSuiteForSingleParameter(Class<?> suiteTestClass, RunnerBuilder runnerBuilder,
Class<?>[] suiteChildClasses, Parameter parameter, String suiteName) throws InitializationError {
try {
ParameterContext.setParameter(parameter);
return new SuiteForSingleParameter(runnerBuilder, suiteTestClass, suiteChildClasses, suiteName, parameter.asNormalized());
} finally {
ParameterContext.removeParameter();
}
}
示例8: CustomSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public CustomSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
super(klass, builder,
new Class<?>[]{
CustomTest.class,
},
null,
false,
TraversalEngine.Type.STANDARD);
}
示例9: AbstractGremlinSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
/**
* Constructs a Gremlin Test Suite implementation.
*
* @param klass Required for JUnit Suite construction
* @param builder Required for JUnit Suite construction
* @param testsToExecute The list of tests to execute
* @param testsToEnforce The list of tests to "enforce" such that a check is made to ensure that in this list,
* there exists an implementation in the testsToExecute (use {@code null} for no
* enforcement).
* @param gremlinFlavorSuite Ignore validation of {@link org.apache.tinkerpop.gremlin.structure.Graph.OptIn}
* annotations which is typically reserved for structure tests
* @param traversalEngineType The {@link org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine.Type} to
* enforce on this suite
*/
public AbstractGremlinSuite(final Class<?> klass, final RunnerBuilder builder, final Class<?>[] testsToExecute,
final Class<?>[] testsToEnforce, final boolean gremlinFlavorSuite,
final TraversalEngine.Type traversalEngineType) throws InitializationError {
super(builder, klass, enforce(testsToExecute, testsToEnforce));
this.gremlinFlavorSuite = gremlinFlavorSuite;
// figures out what the implementer assigned as the GraphProvider class and make it available to tests.
// the klass is the Suite that implements this suite (e.g. GroovyTinkerGraphProcessStandardTest).
// this class should be annotated with GraphProviderClass. Failure to do so will toss an InitializationError
final Pair<Class<? extends GraphProvider>, Class<? extends Graph>> pair = getGraphProviderClass(klass);
// the GraphProvider.Descriptor is only needed right now if the test if for a computer engine - an
// exception is thrown if it isn't present.
final Optional<GraphProvider.Descriptor> graphProviderDescriptor = getGraphProviderDescriptor(traversalEngineType, pair.getValue0());
// validate public acknowledgement of the test suite and filter out tests ignored by the implementation
validateOptInToSuite(pair.getValue1());
validateOptInAndOutAnnotationsOnGraph(pair.getValue1());
registerOptOuts(pair.getValue1(), graphProviderDescriptor, traversalEngineType);
try {
final GraphProvider graphProvider = pair.getValue0().newInstance();
GraphManager.setGraphProvider(graphProvider);
GraphManager.setTraversalEngineType(traversalEngineType);
} catch (Exception ex) {
throw new InitializationError(ex);
}
}
示例10: TinkerGraphStrategySuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public TinkerGraphStrategySuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
super(klass, builder,
new Class<?>[]{
TinkerGraphStepStrategyTest.class
}, new Class<?>[]{
TinkerGraphStepStrategyTest.class
},
false,
TraversalEngine.Type.STANDARD);
}
示例11: Neo4jStrategySuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public Neo4jStrategySuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
super(klass, builder,
new Class<?>[]{
Neo4jGraphStepStrategyTest.class
}, new Class<?>[]{
Neo4jGraphStepStrategyTest.class
},
false,
TraversalEngine.Type.STANDARD);
}
示例12: NativeNeo4jSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public NativeNeo4jSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError {
super(klass, builder,
new Class<?>[]{
NativeNeo4jStructureCheck.class,
NativeNeo4jIndexCheck.class,
NativeNeo4jCypherCheck.class,
}, new Class<?>[]{
NativeNeo4jStructureCheck.class,
NativeNeo4jIndexCheck.class,
NativeNeo4jCypherCheck.class
},
false,
TraversalEngine.Type.STANDARD);
}
示例13: TestsInPkgSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
public TestsInPkgSuite(Class<?> klass, RunnerBuilder builder) throws InitializationError {
super(builder, klass, getPkgTestClasses(klass));
}
示例14: getSuite
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
@Override public Runner getSuite(RunnerBuilder builder, java.lang.Class<?>[] classes) throws InitializationError {
Runner suite = super.getSuite(builder, classes);
return fClasses ? parallelize(suite) : suite;
}
示例15: getRunner
import org.junit.runners.model.RunnerBuilder; //导入依赖的package包/类
@Override protected Runner getRunner(RunnerBuilder builder, Class<?> testClass) throws Throwable {
Runner runner = super.getRunner(builder, testClass);
return fMethods ? parallelize(runner) : runner;
}