Code example for TestResult

Methods: errors

0
		@Test public void error() throws Exception { 
			throw exception;
		} 
	} 
	public void testException() { 
		TestResult result= new TestResult();
		junit.framework.Test adapter= new JUnit4TestAdapter(ErrorTest.class);
		adapter.run(result);
		assertEquals(exception, result.errors().nextElement().thrownException());
	} 
	 
	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 " + test);
			}