1 | public class AllTests {↵ | | 1 | public class AllTests {↵
|
|
2 | private static String[] list = { "DateFilterTest",↵ | | 2 | private static String[] list = { "AddMessageFolderTest",↵
|
3 | "ColorFilterTest", "HeaderfieldFilterTest",↵ | | 3 | "↵
|
4 | "FlagsFilterTest", "BodyFilter↵ | | 4 | ExpungeFolderTest", "CopyMessageFolderTest",↵
|
5 | Test",↵ | | 5 | "GetMessageSourceStreamTest", "GetMimePartSourceStreamTest",↵
|
6 | "PriorityFilterTest","AccountFilterTest",↵ | | 6 | "↵
|
7 | "SizeFilterTest"};↵ | | 7 | GetHeaderFieldsTest","AttributeTest"};↵
|
|
8 | /**↵ | | 8 | /**↵
|
9 | * 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↵
|
10 | * created in the factory.↵ | | 10 | * created in the factory.↵
|
11 | * ↵ | | 11 | * ↵
|
12 | * @param suite↵ | | 12 | * @param suite↵
|
13 | * test suite↵ | | 13 | * test suite↵
|
14 | * @param factory↵ | | 14 | * @param factory↵
|
15 | * factory which creates the folder instances↵ | | 15 | * factory which creates the folder instances↵
|
16 | */↵ | | 16 | */↵
|
17 | private static void setup(TestSuite suite, MailboxTstFactory factory) {↵ | | 17 | private static void setup(TestSuite suite, MailboxTstFactory factory) {↵
|
18 | try {↵ | | 18 | try {↵
|
19 | for (int j = 0; j < list.length; j++) {↵ | | 19 | for (int j = 0; j < list.length; j++) {↵
|
20 | Class clazz = Class.forName("org.columba.mail.filter.plugins."↵ | | 20 | Class clazz = Class.forName("org.columba.mail.folder."↵
|
21 | + list[j]);↵ | | 21 | + list[j]);↵
|
|
22 | Method[] methods = clazz.getDeclaredMethods();↵ | | 22 | Method[] methods = clazz.getDeclaredMethods();↵
|
23 | for (int i = 0; i < methods.length; i++) {↵ | | 23 | for (int i = 0; i < methods.length; i++) {↵
|
24 | if (methods[i].getName().startsWith("test")) {↵ | | 24 | if (methods[i].getName().startsWith("test")) {↵
|
|
25 | suite.addTest((TestCase) clazz.getConstructor(↵ | | 25 | suite.addTest((TestCase) clazz.getConstructor(↵
|
26 | new Class[] { MailboxTstFactory.class,↵ | | 26 | new Class[] { MailboxTstFactory.class,↵
|
27 | String.class}).newInstance(↵ | | 27 | String.class}).newInstance(↵
|
28 | new Object[] { factory, methods[i].getName()}));↵ | | 28 | new Object[] { factory, 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("Test for org.columba.mail.folder");↵ | | 49 | TestSuite suite = new TestSuite("Test for org.columba.mail.folder");↵
|
|
50 | setup(suite, new MHFolderFactory());↵ | | 50 | setup(suite, new MHFolderFactory());↵
|
51 | setup(suite, new MBOXFolderTstFactory());↵ | | 51 | setup(suite, new MBOXFolderTstFactory());↵
|
52 | setup(suite, new TempFolderFactory());↵ | | 52 | setup(suite, new TempFolderFactory());↵
|
53 | // disabled IMAP folder tests as they require connection↵ | | 53 | // disabled IMAP folder tests as they require connection↵
|
54 | // to remote IMAP server↵ | | 54 | // to remote IMAP server↵
|
55 | // setup(suite, new IMAPTstFactory());↵ | | 55 | //setup(suite, new IMAPTstFactory());↵
|
|
56 | return suite | | 56 | return suite
|