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());
}
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());
}
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);
}
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());
}
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"));
}
Aggregations