Java Code Examples for junit.extensions.TestSetup#run()

The following examples show how to use junit.extensions.TestSetup#run() . 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: ExtensionTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testRunningErrorsInTestSetup() {
	TestCase failure= new TestCase("failure") {
		public void runTest() {
			fail();
		}
	};

	TestCase error= new TestCase("error") {
		public void runTest() {
			throw new Error();
		}
	};

	TestSuite suite= new TestSuite();
	suite.addTest(failure);
	suite.addTest(error);
	
	TestSetup wrapper= new TestSetup(suite);

	TestResult result= new TestResult();
	wrapper.run(result);

	assertEquals(1, result.failureCount());
	assertEquals(1, result.errorCount());
}
 
Example 2
Source File: ExtensionTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testRunningErrorInTestSetup() {
	TestCase test= new TestCase("failure") {
		public void runTest() {
			fail();
		}
	};

	TestSetup wrapper= new TestSetup(test);

	TestResult result= new TestResult();
	wrapper.run(result);
	assertTrue(!result.wasSuccessful());
}
 
Example 3
Source File: ExtensionTest.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testSetupErrorInTestSetup() {
	WasRun test= new WasRun();

	TestSetup wrapper= new TestSetup(test) {
		public void setUp() {
			fail();
		}
	};

	TestResult result= new TestResult();
	wrapper.run(result);

	assertTrue(!test.fWasRun);
	assertTrue(!result.wasSuccessful());
}