1 | public class AllTests {↵ | | 1 | public class AllTests {↵
|
|
2 | private static String[] list = { "CopyMessageCommandTest",↵ | | 2 | private static String[] list = { "ReplyCommandTest",↵
|
3 | "MarkMessageTest", "MoveMessageTest", "MoveFolder↵ | | 3 | "ReplyToAllCommandTest", "ReplyToMailingListCommandTest",↵
|
4 | CommandTest" };↵ | | 4 | "ForwardCommandTest", "ForwardInlineCommandTest" };↵
|
|
5 | /**↵ | | 5 | /**↵
|
6 | * Add all testcases to the passed testsuite, using a the folder type as↵ | | 6 | * Add all testcases to the passed testsuite, using a the folder type as↵
|
7 | * created in the factory.↵ | | 7 | * created in the factory.↵
|
8 | * ↵ | | 8 | * ↵
|
9 | * @param suite↵ | | 9 | * @param suite↵
|
10 | * test suite↵ | | 10 | * test suite↵
|
11 | * @param factory↵ | | 11 | * @param factory↵
|
12 | * factory which creates the folder instances↵ | | 12 | * factory which creates the folder instances↵
|
13 | */↵ | | 13 | */↵
|
14 | private static void setup(TestSuite suite, MailboxTstFactory factory) {↵ | | 14 | private static void setup(TestSuite suite, MailboxTstFactory factory) {↵
|
15 | try {↵ | | 15 | try {↵
|
16 | for (int j = 0; j < list.length; j++) {↵ | | 16 | for (int j = 0; j < list.length; j++) {↵
|
17 | Class clazz = Class↵ | | 17 | Class clazz = Class↵
|
18 | .forName("org.columba.mail.folder.command."↵ | | 18 | .forName("org.columba.mail.gui.composer.command."↵
|
19 | + list[j]);↵ | | 19 | + list[j]);↵
|
|
20 | Method[] methods = clazz.getDeclaredMethods();↵ | | 20 | Method[] methods = clazz.getDeclaredMethods();↵
|
21 | for (int i = 0; i < methods.length; i++) {↵ | | 21 | for (int i = 0; i < methods.length; i++) {↵
|
22 | if (methods[i].getName().startsWith("test")) {↵ | | 22 | if (methods[i].getName().startsWith("test")) {↵
|
|
23 | suite↵ | | 23 | suite↵
|
24 | .addTest((TestCase) clazz.getConstructor(↵ | | 24 | .addTest((TestCase) clazz.getConstructor(↵
|
25 | new Class[] { MailboxTstFactory.class,↵ | | 25 | new Class[] { MailboxTstFactory.class,↵
|
26 | String.class }).newInstance(↵ | | 26 | String.class }).newInstance(↵
|
27 | new Object[] { factory,↵ | | 27 | new Object[] { factory,↵
|
28 | methods[i].getName() }));↵ | | 28 | methods[i].getName() }));↵
|
29 | }↵ | | 29 | }↵
|
30 | }↵ | | 30 | }↵
|
31 | }↵ | | 31 | }↵
|
32 | } catch (SecurityException e) {↵ | | 32 | } catch (SecurityException e) {↵
|
|
33 | e.printStackTrace();↵ | | 33 | e.printStackTrace();↵
|
34 | } catch (IllegalArgumentException e) {↵ | | 34 | } catch (IllegalArgumentException e) {↵
|
|
35 | e.printStackTrace();↵ | | 35 | e.printStackTrace();↵
|
36 | } catch (ClassNotFoundException e) {↵ | | 36 | } catch (ClassNotFoundException e) {↵
|
|
37 | e.printStackTrace();↵ | | 37 | e.printStackTrace();↵
|
38 | } catch (InstantiationException e) {↵ | | 38 | } catch (InstantiationException e) {↵
|
|
39 | e.printStackTrace();↵ | | 39 | e.printStackTrace();↵
|
40 | } catch (IllegalAccessException e) {↵ | | 40 | } catch (IllegalAccessException e) {↵
|
|
41 | e.printStackTrace();↵ | | 41 | e.printStackTrace();↵
|
42 | } catch (InvocationTargetException e) {↵ | | 42 | } catch (InvocationTargetException e) {↵
|
|
43 | e.printStackTrace();↵ | | 43 | e.printStackTrace();↵
|
44 | } catch (NoSuchMethodException e) {↵ | | 44 | } catch (NoSuchMethodException e) {↵
|
|
45 | e.printStackTrace();↵ | | 45 | e.printStackTrace();↵
|
46 | }↵ | | 46 | }↵
|
47 | }↵ | | 47 | }↵
|
|
48 | public static Test suite() {↵ | | 48 | public static Test suite() {↵
|
49 | TestSuite suite = new TestSuite(↵ | | 49 | TestSuite suite = new TestSuite(↵
|
50 | "Test for org.columba.mail.folder.command");↵ | | 50 | "Test for org.columba.mail.gui.composer.command");↵
|
|
51 | setup(suite, new MHFolderFactory());↵ | | 51 | setup(suite, new MHFolderFactory());↵
|
52 | setup(suite, new TempFolderFactory());↵ | | 52 | setup(suite, new MBOXFolderTstFactory());↵
|
53 | setup(suite, new MBOXFolderTstFactory());↵ | | 53 | setup(suite, new TempFolderFactory());↵
|
54 | // disabled IMAP folder tests as they require connection↵ | | 54 | // disabled IMAP folder tests as they require connection↵
|
55 | // to remote IMAP server↵ | | 55 | // to remote IMAP server↵
|
56 | // setup(suite, new IMAPTstFactory());↵ | | 56 | // setup(suite, new IMAPTstFactory());↵
|
|
57 | return suite;↵ | | 57 | return suite;↵
|
58 | | | 58 |
|