junit.textui.ResultPrinter Java Examples

The following examples show how to use junit.textui.ResultPrinter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextFeedbackTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testFailure() {
	String expected= expected(new String[]{".F", "Time: 0", "Failures here", "", "FAILURES!!!", "Tests run: 1,  Failures: 1,  Errors: 0", ""});
	ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) {
		public void printFailures(TestResult result) {
			getWriter().println("Failures here");
		}
	};
	runner.setPrinter(printer);
	TestSuite suite = new TestSuite();
	suite.addTest(new TestCase() { public void runTest() {throw new AssertionFailedError();}});
	runner.doRun(suite);
	assertEquals(expected, output.toString());
}
 
Example #2
Source File: TextFeedbackTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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)) {
		public void printErrors(TestResult result) {
			getWriter().println("Errors here");
		}
	};
	runner.setPrinter(printer);
	TestSuite suite = new TestSuite();
	suite.addTest(new TestCase() { public void runTest() throws Exception {throw new Exception();}});
	runner.doRun(suite);
	assertEquals(expected, output.toString());
}