当前位置: 首页>>代码示例>>Java>>正文


Java TestWithParameters类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:17,代码来源:CustomParameterizedRunner.java

示例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);
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:22,代码来源:ParameterizedBehaviorTestFactory.java

示例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();
    }
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:19,代码来源:Parameterized.java

示例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 );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:8,代码来源:RunnerFactory.java

示例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);
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:8,代码来源:CustomParameterizedRunner.java

示例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;
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:12,代码来源:CustomParameterizedRunner.java

示例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));
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:10,代码来源:CustomParameterizedRunner.java

示例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();
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:8,代码来源:CustomParameterizedBlockJUnit4Runner.java

示例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);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:8,代码来源:Parameterized.java

示例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));
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:9,代码来源:Parameterized.java

示例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);
}
 
开发者ID:Netflix,项目名称:denominator,代码行数:8,代码来源:Live.java

示例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);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:5,代码来源:ZKParameterized.java

示例13: Runner

import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
public Runner(TestWithParameters test) throws InitializationError {
    super(test);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:4,代码来源:ZKParameterized.java

示例14: createRunnerForTestWithParameters

import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
@Override
public Runner createRunnerForTestWithParameters(TestWithParameters test)
    throws InitializationError {
  return new CategoryWithParameterizedRunner(test);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:6,代码来源:CategoryWithParameterizedRunnerFactory.java

示例15: CategoryWithParameterizedRunner

import org.junit.runners.parameterized.TestWithParameters; //导入依赖的package包/类
public CategoryWithParameterizedRunner(TestWithParameters test) throws InitializationError {
  super(test);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:4,代码来源:CategoryWithParameterizedRunner.java


注:本文中的org.junit.runners.parameterized.TestWithParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。