1 package test.junit.testsetup; 2 3 import junit.extensions.TestSetup; 4 import junit.framework.TestSuite; 5 6 public class TestSuiteContainerWrapper extends TestSetup { 7 private static Data INSTANCE = null; 8 private static TestSuite _test = null; 9 private static Class dataImpl = null; 10 TestSuiteContainerWrapper(TestSuite testSuite, Class dataImpl)11 public TestSuiteContainerWrapper(TestSuite testSuite, Class dataImpl) { 12 super(testSuite); 13 _test = testSuite; 14 TestSuiteContainerWrapper.dataImpl = dataImpl; 15 } 16 getData()17 public static Data getData() { 18 return INSTANCE; 19 } 20 21 @Override setUp()22 protected void setUp() throws Exception { 23 System.out.println("setup"); 24 INSTANCE = (Data) dataImpl.newInstance(); 25 } 26 27 @Override tearDown()28 protected void tearDown() throws Exception { 29 System.out.println("teardown"); 30 31 INSTANCE = null; 32 33 System.out.println(_test.countTestCases() + " test cases defined by \"" 34 + _test.getName() + "\" were executed."); 35 } 36 } 37