1 17 18 package org.sape.carbon.services.devtools.junit.launcher; 19 20 import java.lang.reflect.InvocationTargetException ; 21 import java.lang.reflect.Method ; 22 import java.lang.reflect.Modifier ; 23 import java.util.HashSet ; 24 import java.util.Iterator ; 25 import java.util.Set ; 26 27 import org.sape.carbon.core.bootstrap.test.BootStrapperTest; 28 import org.sape.carbon.core.util.reflection.ClassFinder; 29 30 import junit.framework.Test; 31 import junit.framework.TestCase; 32 import junit.framework.TestSuite; 33 34 import javax.swing.SwingUtilities ; 35 36 50 public class LauncherSelectedTest extends TestCase { 51 public LauncherSelectedTest(String name) { 52 super(name); 53 } 54 55 62 public static Test suite() { 63 TestSuite suite = new TestSuite(); 64 65 suite.addTest(BootStrapperTest.suite()); 68 69 Iterator testClassIterator = TestLauncher.selectedClasses.iterator(); 70 while(testClassIterator.hasNext()) { 71 String testClassName = (String ) testClassIterator.next(); 72 73 try { 74 Class testClass = Class.forName(testClassName); 75 Method suiteMethod = testClass.getMethod("suite", null); 76 if (Modifier.isStatic(suiteMethod.getModifiers())) { 77 suite.addTest((Test) suiteMethod.invoke(null, null)); 78 } 79 80 } catch(SecurityException e) { 83 } catch(IllegalArgumentException e) { 84 } catch(ClassNotFoundException e) { 85 } catch(NoSuchMethodException e) { 86 } catch(IllegalAccessException e) { 87 } catch(InvocationTargetException e) { 88 } 89 } 90 91 return suite; 92 } 93 94 } 95 | Popular Tags |