Java 类org.junit.internal.runners.JUnit38ClassRunner 实例源码

项目:sosiefier    文件:MaxCore.java   
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();
}
项目:lcm    文件:MaxCore.java   
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();
}
项目:junit    文件:MaxCore.java   
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();
}
项目:org.openntf.domino    文件:MaxCore.java   
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();
}
项目:mlo-gui    文件:JavaFxJUnitRunner.java   
public static Runner createRunnerFor(Class<?> clazz) throws InitializationError {
    if (!shouldSkipClass() && isSubclassOfTestCase(clazz)) {
        return new JUnit38ClassRunner(clazz);
    }

    return new JUnit4ClassRunner(clazz);
}
项目:sosiefier    文件:JUnit3Builder.java   
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    if (isPre4Test(testClass)) {
        return new JUnit38ClassRunner(testClass);
    }
    return null;
}
项目:sosiefier    文件:MaxStarterTest.java   
@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());
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
@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());
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
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));
        }
    }
}
项目:sosiefier    文件:OldTestClassAdaptingListenerTest.java   
@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());
}
项目:lcm    文件:JUnit3Builder.java   
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    if (isPre4Test(testClass)) {
        return new JUnit38ClassRunner(testClass);
    }
    return null;
}
项目:junit    文件:JUnit3Builder.java   
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    if (isPre4Test(testClass)) {
        return new JUnit38ClassRunner(testClass);
    }
    return null;
}
项目:junit    文件:MaxStarterTest.java   
@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());
}
项目:junit    文件:JUnit38ClassRunnerTest.java   
@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());
}
项目:junit    文件:OldTestClassAdaptingListenerTest.java   
@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());
}
项目:org.openntf.domino    文件:JUnit3Builder.java   
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
    if (isPre4Test(testClass)) {
        return new JUnit38ClassRunner(testClass);
    }
    return null;
}
项目:health-and-care-developer-network    文件:MaxStarterTest.java   
@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());
}
项目:health-and-care-developer-network    文件:JUnit38ClassRunnerTest.java   
@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());
}
项目:health-and-care-developer-network    文件:OldTestClassAdaptingListenerTest.java   
@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());
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
@Test
public void plansDecoratorCorrectly() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class)));
    assertEquals(1, runner.testCount());
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
@Test
public void getDescriptionWithAnnotation() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(JUnit3ClassWithAnnotatedMethod.class);
    assertAnnotationFiltering(runner);
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
@Test
public void getDescriptionWithAnnotationInSuper() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(DerivedAnnotatedMethod.class);
    assertAnnotationFiltering(runner);
}
项目:sosiefier    文件:JUnit38ClassRunnerTest.java   
/**
 * 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());  
}
项目:junit    文件:JUnit38ClassRunnerTest.java   
@Test
public void plansDecoratorCorrectly() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class)));
    assertEquals(1, runner.testCount());
}
项目:health-and-care-developer-network    文件:JUnit38ClassRunnerTest.java   
@Test
public void plansDecoratorCorrectly() {
    JUnit38ClassRunner runner = new JUnit38ClassRunner(new TestDecorator(new TestSuite(MyTest.class)));
    assertEquals(1, runner.testCount());
}
项目:sosiefier    文件:JUnitCore.java   
/**
 * 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));
}
项目:lcm    文件:JUnitCore.java   
/**
 * 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));
}
项目:junit    文件:JUnitCore.java   
/**
 * 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));
}
项目:org.openntf.domino    文件:JUnitCore.java   
/**
 * 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));
}