1 package org.columba.mail.gui.composer.command; 19 20 import java.lang.reflect.InvocationTargetException ; 21 import java.lang.reflect.Method ; 22 23 import junit.framework.Test; 24 import junit.framework.TestCase; 25 import junit.framework.TestSuite; 26 27 import org.columba.mail.folder.MBOXFolderTstFactory; 28 import org.columba.mail.folder.MHFolderFactory; 29 import org.columba.mail.folder.MailboxTstFactory; 30 import org.columba.mail.folder.TempFolderFactory; 31 32 36 public class AllTests { 37 38 private static String [] list = { "ReplyCommandTest", 39 "ReplyToAllCommandTest", "ReplyToMailingListCommandTest", 40 "ForwardCommandTest", "ForwardInlineCommandTest" }; 41 42 51 private static void setup(TestSuite suite, MailboxTstFactory factory) { 52 try { 53 for (int j = 0; j < list.length; j++) { 54 Class clazz = Class 55 .forName("org.columba.mail.gui.composer.command." 56 + list[j]); 57 58 Method [] methods = clazz.getDeclaredMethods(); 59 for (int i = 0; i < methods.length; i++) { 60 if (methods[i].getName().startsWith("test")) { 61 62 suite 63 .addTest((TestCase) clazz.getConstructor( 64 new Class [] { MailboxTstFactory.class, 65 String .class }).newInstance( 66 new Object [] { factory, 67 methods[i].getName() })); 68 } 69 } 70 } 71 } catch (SecurityException e) { 72 73 e.printStackTrace(); 74 } catch (IllegalArgumentException e) { 75 76 e.printStackTrace(); 77 } catch (ClassNotFoundException e) { 78 79 e.printStackTrace(); 80 } catch (InstantiationException e) { 81 82 e.printStackTrace(); 83 } catch (IllegalAccessException e) { 84 85 e.printStackTrace(); 86 } catch (InvocationTargetException e) { 87 88 e.printStackTrace(); 89 } catch (NoSuchMethodException e) { 90 91 e.printStackTrace(); 92 } 93 } 94 95 public static Test suite() { 96 TestSuite suite = new TestSuite( 97 "Test for org.columba.mail.gui.composer.command"); 98 99 setup(suite, new MHFolderFactory()); 100 setup(suite, new MBOXFolderTstFactory()); 101 setup(suite, new TempFolderFactory()); 102 106 return suite; 107 } 108 } | Popular Tags |