use of junit.framework.TestCase in project junit4 by junit-team.
the class TextFeedbackTest method testError.
public void testError() {
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);
TestSuite suite = new TestSuite();
suite.addTest(new TestCase() {
@Override
public void runTest() throws Exception {
throw new Exception();
}
});
runner.doRun(suite);
assertEquals(expected, output.toString());
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TextFeedbackTest method testTwoTests.
public void testTwoTests() {
String expected = expected(new String[] { "..", "Time: 0", "", "OK (2 tests)", "" });
TestSuite suite = new TestSuite();
suite.addTest(new TestCase() {
@Override
public void runTest() {
}
});
suite.addTest(new TestCase() {
@Override
public void runTest() {
}
});
runner.doRun(suite);
assertEquals(expected, output.toString());
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TestCaseTest method testNamelessTestCase.
public void testNamelessTestCase() {
TestCase t = new TestCase() {
};
TestResult result = t.run();
assertEquals(1, result.failureCount());
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TestListenerTest method testStartStop.
public void testStartStop() {
TestCase test = new TestCase("noop") {
@Override
public void runTest() {
}
};
test.run(fResult);
assertEquals(1, fStartCount);
assertEquals(1, fEndCount);
}
use of junit.framework.TestCase in project junit4 by junit-team.
the class TestListenerTest method testFailure.
public void testFailure() {
TestCase test = new TestCase("noop") {
@Override
public void runTest() {
fail();
}
};
test.run(fResult);
assertEquals(1, fFailureCount);
assertEquals(1, fEndCount);
}
Aggregations