public class AllTests { private static String[] list = { "DateFilterTest", "ColorFilterTest", "HeaderfieldFilterTest", "FlagsFilterTest", "BodyFilterTest", "PriorityFilterTest","AccountFilterTest", "SizeFilterTest"}; /** * Add all testcases to the passed testsuite, using a the folder type as * created in the factory. * * @param suite * test suite * @param factory * factory which creates the folder instances */ private static void setup(TestSuite suite, MailboxTstFactory factory) { try { for (int j = 0; j < list.length; j++) { Class clazz = Class.forName("org.columba.mail.filter.plugins." + list[j]); Method[] methods = clazz.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().startsWith("test")) { suite.addTest((TestCase) clazz.getConstructor( new Class[] { MailboxTstFactory.class, String.class}).newInstance( new Object[] { factory, methods[i].getName()})); } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } public static Test suite() { TestSuite suite = new TestSuite("Test for org.columba.mail.folder"); setup(suite, new MHFolderFactory()); setup(suite, new MBOXFolderTstFactory()); setup(suite, new TempFolderFactory()); // disabled IMAP folder tests as they require connection // to remote IMAP server // setup(suite, new IMAPTstFactory()); return suite;
public class AllTests { private static String[] list = { "CopyMessageCommandTest", "MarkMessageTest", "MoveMessageTest", "MoveFolderCommandTest" }; /** * Add all testcases to the passed testsuite, using a the folder type as * created in the factory. * * @param suite * test suite * @param factory * factory which creates the folder instances */ private static void setup(TestSuite suite, MailboxTstFactory factory) { try { for (int j = 0; j < list.length; j++) { Class clazz = Class.forName("org.columba.mail.folder.command." + list[j]); Method[] methods = clazz.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().startsWith("test")) { suite .addTest((TestCase) clazz.getConstructor( new Class[] { MailboxTstFactory.class, String.class }).newInstance( new Object[] { factory, methods[i].getName() })); } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } public static Test suite() { TestSuite suite = new TestSuite( "Test for org.columba.mail.folder.command"); setup(suite, new MHFolderFactory()); setup(suite, new TempFolderFactory()); setup(suite, new MBOXFolderTstFactory()); // disabled IMAP folder tests as they require connection // to remote IMAP server // setup(suite, new IMAPTstFactory()); return suite;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/filter/plugins/AllTests.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/folder/command/AllTests.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class AllTests {
1
public class AllTests {
2
    private static String[] list = { "DateFilterTest",
2
	private static String[] list = { "
3
            "ColorFilterTest", "HeaderfieldFilterTest",
4
            "FlagsFilterTest", "BodyFilterTest",
5
            "PriorityFilterTest","AccountFilterTest",
6
			"SizeFilter
3
CopyMessageCommandTest",
7
Test"};
4
			"MarkMessageTest", "MoveMessageTest", "MoveFolderCommandTest" };
8
    /**
9
    
5
	/**
10
 * 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
11
     * created in the factory.
7
	 * created in the factory.
12
     * 
13
    
8
	 * 
14
 * @param suite
9
	 * @param suite
15
     *            test suite
10
	 *            test suite
16
     * @param factory
11
	 * @param factory
17
     *            factory which creates the folder instances
12
	 *            factory which creates the folder instances
18
     */
19
    
13
	 */
20
private static void setup(TestSuite suite, MailboxTstFactory factory) {
14
	private static void setup(TestSuite suite, MailboxTstFactory factory) {
21
        try {
22
            
15
		try {
23
for (int j = 0; j < list.length; j++) {
16
			for (int j = 0; j < list.length; j++) {
24
                Class clazz = Class.forName("org.columba.mail.filter.plugins."
17
				Class clazz = Class.forName("org.columba.mail.f
25
                        + list[j]);
26
                
18
older.command."
19
						+ list[j]);
27
Method[] methods = clazz.getDeclaredMethods();
20
				Method[] methods = clazz.getDeclaredMethods();
28
                for (int i = 0; i < methods.length; i++) {
21
				for (int i = 0; i < methods.length; i++) {
29
                    if (methods[i].getName().startsWith("test")) {
22
					if (methods[i].getName().startsWith("test")) {
30
                        suite
23
						suite
31
.addTest((TestCase) clazz.getConstructor(
24
								.addTest((TestCase) clazz.getConstructor(
32
                                new Class[] { MailboxTstFactory.class,
25
										new Class[] { MailboxTstFactory.class,
33
                                        String.class}).newInstance(
26
												String.class }).newInstance(
34
                                new Object[] { factory, 
27
										new Object[] { factory,
35
methods[i].getName()}));
28
												methods[i].getName() }));
36
                    }
37
                }
38
            }
39
        
29
					}
30
				}
31
			}
40
} catch (SecurityException e) {
32
		} catch (SecurityException e) {
41
            e.printStackTrace();
33
			e.printStackTrace();
42
        } catch (IllegalArgumentException e) {
34
		} catch (IllegalArgumentException e) {
43
            e.printStackTrace();
35
			e.printStackTrace();
44
        } catch (ClassNotFoundException e) {
36
		} catch (ClassNotFoundException e) {
45
            e.printStackTrace();
37
			e.printStackTrace();
46
        } catch (InstantiationException e) {
38
		} catch (InstantiationException e) {
47
            e.printStackTrace();
39
			e.printStackTrace();
48
        } catch (IllegalAccessException e) {
40
		} catch (IllegalAccessException e) {
49
            e.printStackTrace();
41
			e.printStackTrace();
50
        } catch (InvocationTargetException e) {
42
		} catch (InvocationTargetException e) {
51
            e.printStackTrace();
43
			e.printStackTrace();
52
        } catch (NoSuchMethodException e) {
44
		} catch (NoSuchMethodException e) {
53
            e.printStackTrace();
45
			e.printStackTrace();
54
        }
55
    }
56
    
46
		}
47
	}
57
public static Test suite() {
48
	public static Test suite() {
58
        TestSuite suite = new TestSuite(
49
		TestSuite suite = new TestSuite(
59
"Test for org.columba.mail.folder");
50
				"Test for org.columba.mail.folder
60
        
51
.command");
61
setup(suite, new MHFolderFactory());
52
		setup(suite, new MHFolderFactory());
62
        setup(suite, new MBOXFolderTstFactory());
53
		setup(suite, new TempFolderFactory());
63
        setup(suite, new TempFolderFactory());
54
		setup(suite, new MBOXFolderTstFactory());
64
		// disabled IMAP folder tests as they require connection
55
		// disabled IMAP folder tests as they require connection
65
		// to remote IMAP server
56
		// to remote IMAP server
66
		// setup(suite, new IMAPTstFactory());
57
		// setup(suite, new IMAPTstFactory());
67
        return suite;
58
		return suite;
68
    
59
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0