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(); } }
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); }
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(); } }
@Override public org.junit.runner.Runner createRunnerForTestWithParameters( TestWithParameters test ) throws InitializationError { Class<?> klass = test.getTestClass().getJavaClass(); return new RetryRunner( klass, test ); }
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); }
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; }
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)); }
public CustomParameterizedBlockJUnit4Runner(TestWithParameters test) throws InitializationError { super(test.getTestClass().getJavaClass()); parameters = test.getParameters().toArray( new Object[test.getParameters().size()]); name = test.getName(); }
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); }
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)); }
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); }
@Override public org.junit.runner.Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new ZKParameterized.Runner(test); }
public Runner(TestWithParameters test) throws InitializationError { super(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new CategoryWithParameterizedRunner(test); }
public CategoryWithParameterizedRunner(TestWithParameters test) throws InitializationError { super(test); }
public ExposedBlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError { super(test); }
public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new ExposedBlockJUnit4ClassRunnerWithParameters(test); }
public TraceRunnerWithParameters(TestWithParameters test) throws InitializationError { super(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new TraceRunnerWithParameters(test); }
public RetryRunner( Class<?> klass, TestWithParameters test ) throws InitializationError { super( test ); this.parameters = test.getParameters().toArray( new Object[test.getParameters().size()] ); }
public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new CustomParameterizedBlockJUnit4Runner(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new ParameterizedBehaviorTestRunner(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new VertxUnitRunnerWithParameters(test); }
protected VertxUnitRunnerWithParameters(TestWithParameters test) throws InitializationError { super(test.getTestClass().getJavaClass()); parameters = test.getParameters().toArray( new Object[test.getParameters().size()]); name = test.getName(); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new PtlBlockJUnit4ClassRunnerWithParameters(test); }
public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { throw new InitializationError( "Called ExceptionThrowingRunnerFactory."); }
public Runner createRunnerForTestWithParameters( TestWithParameters pTest ) throws InitializationError { return new OrcasBlockJUnit4ClassRunnerWithParameters( pTest ); }
public OrcasBlockJUnit4ClassRunnerWithParameters( TestWithParameters pTest ) throws InitializationError { super( pTest ); testName = (String)pTest.getParameters().get( 0 ); }
public KurentoBlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError { super(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new KurentoBlockJUnit4ClassRunnerWithParameters(test); }
public ParameterizedRunner(TestWithParameters test) throws InitializationError { super(test); }
@Override public Runner createRunnerForTestWithParameters(TestWithParameters test) throws InitializationError { return new ParameterizedRunner(test); }
/** * コンストラクタ * * @param test パラメータ付きテストクラス * @throws InitializationError 初期化に失敗した場合 */ public PtlBlockJUnit4ClassRunnerWithParameters(TestWithParameters test) throws InitializationError { super(test); parameters = test.getParameters().toArray(new Object[test.getParameters().size()]); }