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