Search in sources :

Example 66 with JUnit4TestAdapter

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

the class TestMethodTest method compatibility.

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

Example 67 with JUnit4TestAdapter

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

the class ForwardCompatibilityTest method testNotifyResult.

public void testNotifyResult() {
    JUnit4TestAdapter adapter = new JUnit4TestAdapter(ErrorTest.class);
    TestResult result = new TestResult();
    final StringBuffer log = new StringBuffer();
    result.addListener(new TestListener() {

        public void startTest(junit.framework.Test test) {
            log.append(" start ").append(test);
        }

        public void endTest(junit.framework.Test test) {
            log.append(" end ").append(test);
        }

        public void addFailure(junit.framework.Test test, AssertionFailedError t) {
            log.append(" failure ").append(test);
        }

        public void addError(junit.framework.Test test, Throwable e) {
            log.append(" error " + test);
        }
    });
    adapter.run(result);
    String testName = String.format("error(%s)", ErrorTest.class.getName());
    assertEquals(String.format(" start %s error %s end %s", testName, testName, testName), log.toString());
}
Also used : TestResult(junit.framework.TestResult) TestListener(junit.framework.TestListener) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter) AssertionFailedError(junit.framework.AssertionFailedError)

Example 68 with JUnit4TestAdapter

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

the class ForwardCompatibilityTest method testCompatibility.

public void testCompatibility() {
    fLog = "";
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(NewTest.class);
    adapter.run(result);
    assertEquals("before test after ", fLog);
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 69 with JUnit4TestAdapter

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

the class ForwardCompatibilityTest method testExpected.

public void testExpected() {
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(ExpectedTest.class);
    adapter.run(result);
    assertTrue(result.wasSuccessful());
}
Also used : TestResult(junit.framework.TestResult) JUnit4TestAdapter(junit.framework.JUnit4TestAdapter)

Example 70 with JUnit4TestAdapter

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

the class ForwardCompatibilityTest method testInvalidMethod.

public void testInvalidMethod() {
    TestResult result = new TestResult();
    junit.framework.Test adapter = new JUnit4TestAdapter(InvalidMethodTest.class);
    adapter.run(result);
    assertEquals(1, result.errorCount());
    TestFailure failure = result.errors().nextElement();
    assertTrue(failure.exceptionMessage().contains("Method shouldBeStatic() should be static"));
}
Also used : TestFailure(junit.framework.TestFailure) TestResult(junit.framework.TestResult) 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