本文整理汇总了Java中org.junit.runners.parameterized.TestWithParameters类的典型用法代码示例。如果您正苦于以下问题:Java TestWithParameters类的具体用法?Java TestWithParameters怎么用?Java TestWithParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestWithParameters类属于org.junit.runners.parameterized包,在下文中一共展示了TestWithParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRunnersForParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private List<Runner> createRunnersForParameters(
Iterable<Object> allParameters, String namePattern,
ParametersRunnerFactory runnerFactory) throws Exception {
try {
List<TestWithParameters> tests = createTestsForParameters(
allParameters, namePattern);
List<Runner> runners = new ArrayList<Runner>();
for (TestWithParameters test : tests) {
runners.add(runnerFactory
.createRunnerForTestWithParameters(test));
}
return runners;
} catch (ClassCastException e) {
throw parametersMethodReturnedWrongType();
}
}
示例2: ParameterizedBehaviorTestRunner
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
ParameterizedBehaviorTestRunner(TestWithParameters test) throws InitializationError {
super(test);
FeatureSet features = FluentIterable
.from(test.getParameters())
.filter(FeatureSet.class)
.first()
.orNull();
checkState(features != null, "No FeatureSet parameter found");
// JDK-8 bug: Cannot use `super::` if the superclass method is protected; see
// https://bugs.openjdk.java.net/browse/JDK-8139836
testing = new SharedBehaviorTesting(
notifier -> super.childrenInvoker(notifier),
(method, notifier) -> super.runChild(method, notifier),
super::createTest,
super::getDescription,
super::getTestClass,
(cls, name) -> Description.createTestDescription(cls, name + test.getParameters()),
features);
}
示例3: createRunnersForParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private List<Runner> createRunnersForParameters(
Iterable<Object> allParameters, String namePattern,
ParametersRunnerFactory runnerFactory)
throws InitializationError,
Exception {
try {
List<TestWithParameters> tests = createTestsForParameters(
allParameters, namePattern);
List<Runner> runners = new ArrayList<Runner>();
for (TestWithParameters test : tests) {
runners.add(runnerFactory
.createRunnerForTestWithParameters(test));
}
return runners;
} catch (ClassCastException e) {
throw parametersMethodReturnedWrongType();
}
}
示例4: createRunnerForTestWithParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
@Override
public org.junit.runner.Runner createRunnerForTestWithParameters( TestWithParameters test )
throws InitializationError
{
Class<?> klass = test.getTestClass().getJavaClass();
return new RetryRunner( klass, test );
}
示例5: createTestWithNotNormalizedParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private TestWithParameters createTestWithNotNormalizedParameters(
String pattern, int index, Object parametersOrSingleParameter) {
Object[] parameters = (parametersOrSingleParameter instanceof Object[]) ? (Object[]) parametersOrSingleParameter
: new Object[] { parametersOrSingleParameter };
return createTestWithParameters(testClass, pattern, index,
parameters);
}
示例6: createTestsForParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private List<TestWithParameters> createTestsForParameters(
Iterable<Object> allParameters, String namePattern)
throws Exception {
int i = 0;
List<TestWithParameters> children = new ArrayList<TestWithParameters>();
for (Object parametersOfSingleTest : allParameters) {
children.add(createTestWithNotNormalizedParameters(namePattern,
i++, parametersOfSingleTest));
}
return children;
}
示例7: createTestWithParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private TestWithParameters createTestWithParameters(
TestClass testClass, String pattern, int index,
Object[] parameters) {
String finalPattern = pattern.replaceAll("\\{index\\}",
Integer.toString(index));
String name = MessageFormat.format(finalPattern, parameters);
return new TestWithParameters("[" + name + "]", testClass,
Arrays.asList(parameters));
}
示例8: CustomParameterizedBlockJUnit4Runner
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
public CustomParameterizedBlockJUnit4Runner(TestWithParameters test)
throws InitializationError {
super(test.getTestClass().getJavaClass());
parameters = test.getParameters().toArray(
new Object[test.getParameters().size()]);
name = test.getName();
}
示例9: createTestWithNotNormalizedParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private TestWithParameters createTestWithNotNormalizedParameters(
String pattern, int index, Object parametersOrSingleParameter) {
Object[] parameters= (parametersOrSingleParameter instanceof Object[]) ? (Object[]) parametersOrSingleParameter
: new Object[] { parametersOrSingleParameter };
return createTestWithParameters(getTestClass(), pattern, index,
parameters);
}
示例10: createTestWithParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
private static TestWithParameters createTestWithParameters(
TestClass testClass, String pattern, int index, Object[] parameters) {
String finalPattern = pattern.replaceAll("\\{index\\}",
Integer.toString(index));
String name = MessageFormat.format(finalPattern, parameters);
return new TestWithParameters("[" + name + "]", testClass,
Arrays.asList(parameters));
}
示例11: createRunners
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
protected List<Runner> createRunners(Class<?> klass) throws InitializationError {
List<Runner> result = new ArrayList<Runner>();
TestWithParameters test = new TestWithParameters(graph.manager().toString(), getTestClass(),
Arrays.<Object>asList(graph.manager()));
result.add(new BlockJUnit4ClassRunnerWithParameters(test));
return Collections.unmodifiableList(result);
}
示例12: createRunnerForTestWithParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
@Override
public org.junit.runner.Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError {
return new ZKParameterized.Runner(test);
}
示例13: Runner
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
public Runner(TestWithParameters test) throws InitializationError {
super(test);
}
示例14: createRunnerForTestWithParameters
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
@Override
public Runner createRunnerForTestWithParameters(TestWithParameters test)
throws InitializationError {
return new CategoryWithParameterizedRunner(test);
}
示例15: CategoryWithParameterizedRunner
import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
public CategoryWithParameterizedRunner(TestWithParameters test) throws InitializationError {
super(test);
}