Code example for TestResult

Methods: errorCount, errors

0
		@BeforeClass public void shouldBeStatic() {} 
		@Test public void aTest() {} 
	} 
	 
	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"));
	} 
	 
	private static boolean wasRun= false;
	 
	public static class MarkerRunner extends Runner { 
		public MarkerRunner(Class<?> klass) {
		} 
 
		@Override 
		public void run(RunNotifier notifier) {