當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。