org.junit.runners.parameterized.ParametersRunnerFactory Java Examples

The following examples show how to use org.junit.runners.parameterized.ParametersRunnerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomParameterizedRunner.java    From registry with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #2
Source File: CustomParameterizedRunner.java    From registry with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #3
Source File: CustomParameterizedRunner.java    From registry with Apache License 2.0 5 votes vote down vote up
private ParametersRunnerFactory getParametersRunnerFactory()
        throws InstantiationException, IllegalAccessException {
    UseParametersRunnerFactory annotation = testClass
            .getAnnotation(UseParametersRunnerFactory.class);
    if (annotation == null) {
        return DEFAULT_FACTORY;
    } else {
        Class<? extends ParametersRunnerFactory> factoryClass = annotation
                .value();
        return factoryClass.newInstance();
    }
}
 
Example #4
Source File: CustomParameterizedRunner.java    From registry with Apache License 2.0 5 votes vote down vote up
private ParametersRunnerFactory getParametersRunnerFactory()
        throws InstantiationException, IllegalAccessException {
    UseParametersRunnerFactory annotation = testClass
            .getAnnotation(UseParametersRunnerFactory.class);
    if (annotation == null) {
        return DEFAULT_FACTORY;
    } else {
        Class<? extends ParametersRunnerFactory> factoryClass = annotation
                .value();
        return factoryClass.newInstance();
    }
}