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


Java InitializationError类代码示例

本文整理汇总了Java中org.junit.runners.model.InitializationError的典型用法代码示例。如果您正苦于以下问题:Java InitializationError类的具体用法?Java InitializationError怎么用?Java InitializationError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InitializationError类属于org.junit.runners.model包,在下文中一共展示了InitializationError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Courgette

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public Courgette(Class clazz) throws IOException, InitializationError {
    super(clazz);
    classLoader = clazz.getClassLoader();

    final CourgetteOptions courgetteOptions = getCourgetteOptions(clazz);
    courgetteProperties = new CourgetteProperties(courgetteOptions, createSessionId(), courgetteOptions.threads());

    final CourgetteFeatureLoader courgetteFeatureLoader = new CourgetteFeatureLoader(courgetteProperties);
    cucumberFeatures = courgetteFeatureLoader.getCucumberFeatures();

    runtimeOptions = courgetteFeatureLoader.getCucumberRuntimeOptions();

    runnerInfoList = new ArrayList<>();

    if (courgetteOptions.runLevel().equals(CourgetteRunLevel.FEATURE)) {
        cucumberFeatures.forEach(feature -> runnerInfoList.add(new CourgetteRunnerInfo(courgetteProperties, feature, null)));
    } else {
        final Map<CucumberFeature, Integer> scenarios = courgetteFeatureLoader.getCucumberScenarios();
        scenarios
                .keySet()
                .forEach(scenario -> runnerInfoList.add(new CourgetteRunnerInfo(courgetteProperties, scenario, scenarios.get(scenario))));
    }
}
 
开发者ID:prashant-ramcharan,项目名称:courgette-jvm,代码行数:24,代码来源:Courgette.java

示例2: RoboOleaster

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public RoboOleaster(Class testClass) throws InitializationError {
    super(testClass);
    Config config = getConfig(testClass);
    AndroidManifest androidManifest = getAppManifest(config);
    interceptors = new Interceptors(findInterceptors());
    SdkEnvironment sdkEnvironment = getSandbox(config, androidManifest);

    // Configure shadows *BEFORE* setting the ClassLoader. This is necessary because
    // creating the ShadowMap loads all ShadowProviders via ServiceLoader and this is
    // not available once we install the Robolectric class loader.
    configureShadows(sdkEnvironment);

    Class bootstrappedTestClass = sdkEnvironment.bootstrappedClass(testClass);
    try {

        this.oleasterRobolectricRunner = sdkEnvironment
                .bootstrappedClass(OleasterRobolectricRunner.class)
                .getConstructor(Class.class, SdkEnvironment.class, Config.class, AndroidManifest.class)
                .newInstance(bootstrappedTestClass, sdkEnvironment, config, androidManifest);

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:bangarharshit,项目名称:Oleaster,代码行数:25,代码来源:RoboOleaster.java

示例3: createRunners

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private static List<Runner> createRunners(final Class<?> clazz) throws InitializationError {
    final ValueConverter defaultValueConverter = getDefaultValueConverter(clazz);
    final List<Runner> runners = new ArrayList<>();
    final Table classWideTable = classWideTableOrNull(clazz);
    if (classWideTable != null) {
        for (final TableRow row : classWideTable) {
            runners.add(new SingleRowMultiTestRunner(clazz, row, defaultValueConverter));
        }
    } else {
        for (final FrameworkMethod testMethod : new TestClass(clazz).getAnnotatedMethods(Test.class)) {
            final Spockito.UseValueConverter useValueConverter = testMethod.getAnnotation(Spockito.UseValueConverter.class);
            final ValueConverter methodValueConverter = Spockito.getValueConverter(useValueConverter, defaultValueConverter);
            runners.add(new SingleTestMultiRowRunner(clazz, testMethod, methodValueConverter));
        }
    }
    return runners;
}
 
开发者ID:tools4j,项目名称:spockito,代码行数:18,代码来源:Spockito.java

示例4: BytecoderUnitTestRunner

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public BytecoderUnitTestRunner(Class aClass) throws InitializationError {
    super(aClass);
    testClass = new TestClass(aClass);
    testMethods = new ArrayList<>();

    Method[] classMethods = aClass.getDeclaredMethods();
    for (Method classMethod : classMethods) {
        Class retClass = classMethod.getReturnType();
        int length = classMethod.getParameterTypes().length;
        int modifiers = classMethod.getModifiers();
        if (retClass == null || length != 0 || Modifier.isStatic(modifiers)
                || !Modifier.isPublic(modifiers) || Modifier.isInterface(modifiers)
                || Modifier.isAbstract(modifiers)) {
            continue;
        }
        String methodName = classMethod.getName();
        if (methodName.toUpperCase().startsWith("TEST")
                || classMethod.getAnnotation(Test.class) != null) {
            testMethods.add(new FrameworkMethod(classMethod));
        }
        if (classMethod.getAnnotation(Ignore.class) != null) {
            testMethods.remove(classMethod);
        }
    }
}
 
开发者ID:mirkosertic,项目名称:Bytecoder,代码行数:26,代码来源:BytecoderUnitTestRunner.java

示例5: runWithIncompleteAssignments

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private void runWithIncompleteAssignments(ProducerAssignments assignments) throws Throwable {
    List<ParameterProducer> parameterProducers = assignments.potentialNextParameterProducers();
    if (parameterProducers.isEmpty()) {
        throw new InitializationError(
                "No @DataProducer found to inject to suite method " + method.getName());
    }
    for (ParameterProducer parameterProducer : parameterProducers) {
        runWithAssignments(assignments.assignNext(parameterProducer));
    }
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:11,代码来源:AssignmentsStatement.java

示例6: validateFactoryMethod

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private void validateFactoryMethod(Method factoryMethod) throws InitializationError {
    if (!factoryMethod.getReturnType().isAssignableFrom(testClass.getJavaClass())) {
        throw new InitializationError("Illegal factory method return type.");
    }
    if (!Modifier.isStatic(factoryMethod.getModifiers())) {
        throw new InitializationError("@FactoryMethod must be static!");
    }
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:9,代码来源:TestObject.java

示例7: getMethodGenericReturnType

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private static Type getMethodGenericReturnType (Method method) throws InitializationError {
    final Type genericReturnType = method.getGenericReturnType();
    if (genericReturnType instanceof ParameterizedTypeImpl) {
        final Type[] actualTypeArguments = ((ParameterizedTypeImpl) genericReturnType).getActualTypeArguments();
        return actualTypeArguments[0];
    }
    throw new InitializationError(
            "Illegal return type of " + genericReturnType + " for method as @DataProducer");
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:10,代码来源:PotentialAssignments.java

示例8: shouldValidateMethodProducerReturnType

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
@Test
public void shouldValidateMethodProducerReturnType() throws Exception {
    TestClass testClass = new TestClass(ProducerIsNotCollection.class);
    ProducerAssignments assignments = ProducerAssignments.allUnassigned(
            testClass, testClass.getJavaClass().getMethod("a", String.class));

    assertThatExceptionOfType(InitializationError.class)
            .isThrownBy(assignments::potentialNextParameterProducers);
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:10,代码来源:ProducerAssignmentsMethodAsProducerTest.java

示例9: shouldThrowExceptionOnNoDataProducer

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
@Test
public void shouldThrowExceptionOnNoDataProducer() throws Throwable {
    Method testMethod = NoDataProducer.class.getMethod("a", String.class);
    FrameworkMethod method = new FrameworkMethod(testMethod);
    FrameworkMethod spyMethod = spy(method);
    when(spyMethod.getAnnotation(Ignore.class)).thenReturn(null);
    assertThatExceptionOfType(InitializationError.class).isThrownBy(() ->
            new JUnitEasyTools(NoDataProducer.class).methodBlock(method).evaluate());
}
 
开发者ID:SeriyBg,项目名称:junit-easy-tools,代码行数:10,代码来源:JUnitEasyToolsValidationTest.java

示例10: initExecutions

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private void initExecutions() {
    if (!executionsInitialized) {
        try {
            Runner descriptionProvider = createRunnerFor(Arrays.asList(target), Collections.<Filter>emptyList());
            templateDescription = descriptionProvider.getDescription();
        } catch (InitializationError initializationError) {
            throw UncheckedException.throwAsUncheckedException(initializationError);
        }
        createExecutions();
        for (Execution execution : executions) {
            execution.init(target, templateDescription);
        }
        executionsInitialized = true;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:AbstractMultiTestRunner.java

示例11: toModules

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
private Iterable<? extends Module> toModules(final Class<? extends Module>[] baseModules) {
	return transform(newArrayList(baseModules), moduleClass -> {
		try {
			return moduleClass.newInstance();
		} catch (InstantiationException | IllegalAccessException e) {
			throw new RuntimeException(new InitializationError(e));
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:JUnitGuiceClassRunner.java

示例12: DockerUnitRunner

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public DockerUnitRunner(Class<?> klass) throws InitializationError {
    super(klass);
    ServiceLoader<DiscoveryProviderFactory> loader = ServiceLoader.load(DiscoveryProviderFactory.class);
    List<DiscoveryProviderFactory> implementations = new ArrayList<>();
    loader.forEach(impl -> {
    	logger.info("Found discovery provider factory of type " + impl.getClass().getSimpleName());
    	implementations.add(impl);
    });
    if(implementations.size() > 0) {
    	logger.info("Using discovery provider factory " + implementations.get(0).getClass().getSimpleName());
    	discoveryProvider = implementations.get(0).getProvider();
    } else {
    	throw new InitializationError("No discovery provider factory found. Aborting test.");
    }
}
 
开发者ID:qzagarese,项目名称:dockerunit,代码行数:16,代码来源:DockerUnitRunner.java

示例13: EasySuite

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
/**
 * Called by this class and subclasses once the runners making up the suite have been determined
 *
 * @param klass   root of the suite
 * @param runners for each class in the suite, a {@link Runner}
 */
protected EasySuite(Class<?> klass, List<Runner> runners) throws InitializationError {
    super(klass);
    try {
        Class.forName(klass.getName());
    } catch (Exception e) {
        e.printStackTrace();
    }
    this.runners = Collections.unmodifiableList(runners);
}
 
开发者ID:easymall,项目名称:easy-test,代码行数:16,代码来源:EasySuite.java

示例14: OleasterRobolectricRunner

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public OleasterRobolectricRunner(
        Class<?> testClass,
        SdkEnvironment sandbox,
        Config config,
        AndroidManifest androidManifest)
        throws
        InitializationError {
    super(testClass);
    this.sandbox = sandbox;

    this.config = config;
    this.androidManifest = androidManifest;
}
 
开发者ID:bangarharshit,项目名称:Oleaster,代码行数:14,代码来源:OleasterRobolectricRunner.java

示例15: SingleRowMultiTestRunner

import org.junit.runners.model.InitializationError; //导入依赖的package包/类
public SingleRowMultiTestRunner(final Class<?> clazz,
                                final TableRow tableRow,
                                final ValueConverter defaultValueConverter) throws InitializationError {
    super(clazz);
    this.tableRow = Objects.requireNonNull(tableRow);
    this.defaultValueConverter = Objects.requireNonNull(defaultValueConverter);
    validate();
}
 
开发者ID:tools4j,项目名称:spockito,代码行数:9,代码来源:SingleRowMultiTestRunner.java


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