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


Java JUnit38ClassRunner类代码示例

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


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

示例1: buildRunner

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't locate a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:22,代码来源:MaxCore.java

示例2: buildRunner

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't build a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:22,代码来源:MaxCore.java

示例3: createRunnerFor

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
public static Runner createRunnerFor(Class<?> clazz) throws InitializationError {
    if (!shouldSkipClass() && isSubclassOfTestCase(clazz)) {
        return new JUnit38ClassRunner(clazz);
    }
 
    return new JUnit4ClassRunner(clazz);
}
 
开发者ID:o3project,项目名称:mlo-gui,代码行数:8,代码来源:JavaFxJUnitRunner.java

示例4: runnerForClass

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    if (isPre4Test(testClass)) {
        return new JUnit38ClassRunner(testClass);
    }
    return null;
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:8,代码来源:JUnit3Builder.java

示例5: filterSingleMethodFromOldTestClass

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void filterSingleMethodFromOldTestClass() throws Exception {
    final Description method = Description.createTestDescription(
            TwoOldTests.class, "testOne");
    Filter filter = Filter.matchMethodDescription(method);
    JUnit38ClassRunner child = new JUnit38ClassRunner(TwoOldTests.class);
    child.filter(filter);
    assertEquals(1, child.testCount());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:MaxStarterTest.java

示例6: canUnadaptAnAdapter

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void canUnadaptAnAdapter() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new JUnit4TestAdapter(AnnotatedTest.class));
    Result result = new JUnitCore().run(runner);
    Failure failure = result.getFailures().get(0);
    assertEquals(Description.createTestDescription(AnnotatedTest.class, "foo"), failure.getDescription());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:8,代码来源:JUnit38ClassRunnerTest.java

示例7: assertAnnotationFiltering

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
private void assertAnnotationFiltering(JUnit38ClassRunner runner) {
    Description d = runner.getDescription();
    assertEquals(2, d.testCount());
    for (Description methodDesc : d.getChildren()) {
        if (methodDesc.getMethodName().equals("testAnnotated")) {
            assertNotNull(methodDesc.getAnnotation(MyAnnotation.class));
        } else {
            assertNull(methodDesc.getAnnotation(MyAnnotation.class));
        }
    }
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:JUnit38ClassRunnerTest.java

示例8: addFailureDelegatesToNotifier

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void addFailureDelegatesToNotifier() {
    Result result = new Result();
    RunListener listener = result.createListener();
    RunNotifier notifier = new RunNotifier();
    notifier.addFirstListener(listener);
    TestCase testCase = new TestCase() {
    };
    TestListener adaptingListener = new JUnit38ClassRunner(testCase)
            .createAdaptingListener(notifier);
    adaptingListener.addFailure(testCase, new AssertionFailedError());
    assertEquals(1, result.getFailureCount());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:14,代码来源:OldTestClassAdaptingListenerTest.java

示例9: plansDecoratorCorrectly

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void plansDecoratorCorrectly() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class)));
    assertEquals(1, runner.testCount());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:6,代码来源:JUnit38ClassRunnerTest.java

示例10: getDescriptionWithAnnotation

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void getDescriptionWithAnnotation() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(JUnit3ClassWithAnnotatedMethod.class);
    assertAnnotationFiltering(runner);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:6,代码来源:JUnit38ClassRunnerTest.java

示例11: getDescriptionWithAnnotationInSuper

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
@Test
public void getDescriptionWithAnnotationInSuper() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(DerivedAnnotatedMethod.class);
    assertAnnotationFiltering(runner);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:6,代码来源:JUnit38ClassRunnerTest.java

示例12: filterNoTestsRemain

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
/**
 * Test that NoTestsRemainException is thrown when all methods have been filtered.
 */
@Test(expected = NoTestsRemainException.class) 
public void filterNoTestsRemain() throws NoTestsRemainException {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(OneTest.class);
    runner.filter(new RejectAllTestsFilter());  
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:9,代码来源:JUnit38ClassRunnerTest.java

示例13: run

import org.junit.internal.runners.JUnit38ClassRunner; //导入依赖的package包/类
/**
 * Run all the tests contained in JUnit 3.8.x <code>test</code>. Here for backward compatibility.
 *
 * @param test the old-style test
 * @return a {@link Result} describing the details of the test run and the failed tests.
 */
public Result run(junit.framework.Test test) {
    return run(new JUnit38ClassRunner(test));
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:10,代码来源:JUnitCore.java


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