Search in sources :

Example 36 with JUnit4TestAdapter

use of junit.framework.JUnit4TestAdapter in project junit4 by junit-team.

the class JUnit38ClassRunnerTest method canUnadaptAnAdapter.

@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());
}
Also used : JUnitCore(org.junit.runner.JUnitCore) JUnit38ClassRunner(org.junit.internal.runners.JUnit38ClassRunner) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) Failure(org.junit.runner.notification.Failure) Result(org.junit.runner.Result) Test(org.junit.Test)

Example 37 with JUnit4TestAdapter

use of junit.framework.JUnit4TestAdapter in project junit4 by junit-team.

the class ForwardCompatibilityPrintingTest method testErrorAdapted.

public void testErrorAdapted() {
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    TestRunner runner = new TestRunner(new TestResultPrinter(new PrintStream(output)));
    String expected = expected(new String[] { ".E", "Time: 0", "Errors here", "", "FAILURES!!!", "Tests run: 1,  Failures: 0,  Errors: 1", "" });
    ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {

        @Override
        public void printErrors(TestResult result) {
            getWriter().println("Errors here");
        }
    };
    runner.setPrinter(printer);
    runner.doRun(new JUnit4TestAdapter(ATest.class));
    assertEquals(expected, output.toString());
}
Also used : PrintStream(java.io.PrintStream) ResultPrinter(junit.textui.ResultPrinter) TestRunner(junit.textui.TestRunner) TestResult(junit.framework.TestResult) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 38 with JUnit4TestAdapter

use of junit.framework.JUnit4TestAdapter in project junit4 by junit-team.

the class JUnit4TestAdapterTest method doTest.

private static void doTest(Class<?> clazz) {
    // JUnit 4 runner:
    Result result = JUnitCore.runClasses(clazz);
    assertEquals(1, result.getRunCount());
    assertEquals(0, result.getFailureCount());
    assertEquals(0, result.getIgnoreCount());
    // JUnit 3 runner:
    TestResult testResult = new TestResult();
    new JUnit4TestAdapter(clazz).run(testResult);
    assertEquals(1, testResult.runCount());
    assertEquals(0, testResult.failureCount());
    assertEquals(Collections.emptyList(), Collections.list(testResult.errors()));
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) Result(org.junit.runner.Result) TestResult(junit.framework.TestResult)

Example 39 with JUnit4TestAdapter

use of junit.framework.JUnit4TestAdapter in project junit4 by junit-team.

the class TimeoutTest method compatibility.

@Test
public void compatibility() {
    TestResult result = new TestResult();
    new JUnit4TestAdapter(InfiniteLoopTest.class).run(result);
    assertEquals(1, result.errorCount());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) Test(org.junit.Test)

Example 40 with JUnit4TestAdapter

use of junit.framework.JUnit4TestAdapter in project JMRI by JMRI.

the class PackageTest method suite.

// test suite from all defined tests
public static Test suite() {
    TestSuite suite = new TestSuite(PackageTest.class.getName());
    suite.addTest(new JUnit4TestAdapter(BlockTableActionTest.class));
    suite.addTest(LogixTableActionTest.suite());
    suite.addTest(LRouteTableActionTest.suite());
    suite.addTest(OBlockTableActionTest.suite());
    suite.addTest(new JUnit4TestAdapter(RouteTableActionTest.class));
    suite.addTest(SensorTableWindowTest.suite());
    suite.addTest(new JUnit4TestAdapter(SignalGroupTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SignalHeadTableActionTest.class));
    suite.addTest(TurnoutTableWindowTest.suite());
    suite.addTest(new JUnit4TestAdapter(BundleTest.class));
    suite.addTest(new JUnit4TestAdapter(jmri.jmrit.beantable.signalmast.PackageTest.class));
    suite.addTest(jmri.jmrit.beantable.sensor.PackageTest.suite());
    suite.addTest(jmri.jmrit.beantable.oblock.PackageTest.suite());
    suite.addTest(jmri.jmrit.beantable.beanedit.PackageTest.suite());
    suite.addTest(new JUnit4TestAdapter(jmri.jmrit.beantable.usermessagepreferences.PackageTest.class));
    suite.addTest(new JUnit4TestAdapter(MemoryTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(AudioTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(BeanTableFrameTest.class));
    suite.addTest(new JUnit4TestAdapter(BeanTablePaneTest.class));
    suite.addTest(new JUnit4TestAdapter(EnablingCheckboxRendererTest.class));
    suite.addTest(new JUnit4TestAdapter(IdTagTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(LightTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(LightTableTabActionTest.class));
    suite.addTest(new JUnit4TestAdapter(ListedTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(ListedTableFrameTest.class));
    suite.addTest(new JUnit4TestAdapter(MaintenanceTest.class));
    suite.addTest(new JUnit4TestAdapter(RailComTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(ReporterTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SectionTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SensorTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SensorTableTabActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SignalGroupSubTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SignalMastLogicTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SignalMastTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(TransitTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(TurnoutTableActionTest.class));
    suite.addTest(new JUnit4TestAdapter(TurnoutTableTabActionTest.class));
    suite.addTest(new JUnit4TestAdapter(SetPhysicalLocationActionTest.class));
    return suite;
}
Also used : TestSuite(junit.framework.TestSuite) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Aggregations

JUnit4TestAdapter (junit.framework.JUnit4TestAdapter)74 TestSuite (junit.framework.TestSuite)50 TestResult (junit.framework.TestResult)17 Test (org.junit.Test)6 Test (junit.framework.Test)2 Result (org.junit.runner.Result)2 I18nManagerTest (com.agiletec.aps.system.services.i18n.I18nManagerTest)1 I18nManagerCacheWrapperTest (com.agiletec.aps.system.services.i18n.cache.I18nManagerCacheWrapperTest)1 KeyGeneratorManagerTest (com.agiletec.aps.system.services.keygenerator.KeyGeneratorManagerTest)1 LangManagerTest (com.agiletec.aps.system.services.lang.LangManagerTest)1 ContentManagerTest (com.agiletec.plugins.jacms.aps.system.services.content.ContentManagerTest)1 ContentModelManagerTest (com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModelManagerTest)1 ContentPageMapperManagerTest (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.ContentPageMapperManagerTest)1 ContentMapperCacheWrapperTest (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.cache.ContentMapperCacheWrapperTest)1 ResourceManagerTest (com.agiletec.plugins.jacms.aps.system.services.resource.ResourceManagerTest)1 ListLastIndexOfTester (com.google.common.collect.testing.testers.ListLastIndexOfTester)1 ListListIteratorTester (com.google.common.collect.testing.testers.ListListIteratorTester)1 ListSubListTester (com.google.common.collect.testing.testers.ListSubListTester)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1