Code example for TestResult

Methods: endTest, errorCount, failureCount, runCount, runProtected, startTest

0
		public int countTestCases() { 
			return 2; 
		} 
		 
		public void run(TestResult result) {
			result.startTest(this);
			Protectable p= new Protectable() {
				public void protect() throws Throwable { 
					fTestCase.runBare();
					fTestCase.runBare();
				} 
			}; 
			result.runProtected(this, p);
			result.endTest(this);
		} 
	} 
	 
	private DoubleTestCase fTest;
	 
	public TestImplementorTest() { 
		TestCase testCase= new TestCase() {
			@Override 
			public void runTest() { 
			} 
		}; 
		fTest= new DoubleTestCase(testCase);
	} 
	 
	public void testSuccessfulRun() { 
		TestResult result= new TestResult();
		fTest.run(result);
		assertEquals(fTest.countTestCases(), result.runCount());
		assertEquals(0, result.errorCount());
		assertEquals(0, result.failureCount());
	} 
}