class AllTests { private static String[] list = { "ReplyCommandTest", "ReplyToAllCommandTest", "ReplyToMailingListCommandTest", "ForwardCommandTest", "ForwardInlineCommandTest" }; /** * 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.gui.composer.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.gui.composer.command"); 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; } }
class AllTests { private static String[] list = { "AddMessageFolderTest", "ExpungeFolderTest", "CopyMessageFolderTest", "GetMessageSourceStreamTest", "GetMimePartSourceStreamTest", "GetHeaderFieldsTest","AttributeTest"}; /** * 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." + 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; } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/gui/composer/command/AllTests.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/folder/AllTests.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
class AllTests {
1
class AllTests {
2
	private static String[] list = { "ReplyCommandTest",
2
    private static String[] list = { "
3
			"ReplyToAllCommandTest", "ReplyToMailingListCommandTest",
4
			"ForwardCommandTest", "ForwardInlineCommand
3
AddMessageFolderTest",
4
            "ExpungeFolderTest", "CopyMessageFolderTest",
5
            "GetMessageSourceStreamTest", "GetMimePartSourceStreamTest",
5
Test" };
6
            "GetHeaderFieldsTest","AttributeTest"};
6
	/**
7
	
7
    /**
8
 * Add all testcases to the passed testsuite, using a the folder type as
8
     * Add all testcases to the passed testsuite, using a the folder type as
9
	 * created in the factory.
9
     * created in the factory.
10
	 * 
11
	
10
     * 
12
 * @param suite
11
     * @param suite
13
	 *            test suite
12
     *            test suite
14
	 * @param factory
13
     * @param factory
15
	 *            factory which creates the folder instances
14
     *            factory which creates the folder instances
16
	 */
17
	
15
     */
18
private static void setup(TestSuite suite, MailboxTstFactory factory) {
16
    private static void setup(TestSuite suite, MailboxTstFactory factory) {
19
		try {
20
			
17
        try {
21
for (int j = 0; j < list.length; j++) {
18
            for (int j = 0; j < list.length; j++) {
22
				Class clazz = Class
19
                Class clazz = Class
23
						.forName("org.columba.mail.gui.composer.command."
20
.forName("org.columba.mail.
24
								+ list[j]);
25
				
21
folder."
22
                        + list[j]);
26
Method[] methods = clazz.getDeclaredMethods();
23
                Method[] methods = clazz.getDeclaredMethods();
27
				for (int i = 0; i < methods.length; i++) {
24
                for (int i = 0; i < methods.length; i++) {
28
					if (methods[i].getName().startsWith("test")) {
25
                    if (methods[i].getName().startsWith("test")) {
29
						suite
30
								.addTest((TestCase) clazz.getConstructor(
26
                        suite.addTest((TestCase) clazz.getConstructor(
31
										new Class[] { MailboxTstFactory.class,
27
                                new Class[] { MailboxTstFactory.class,
32
												String.class }).newInstance(
28
                                        String.class}).newInstance(
33
										new Object[] { factory,
29
                                new Object[] { factory,
34
												methods[i].getName() }));
30
 methods[i].getName()}));
35
					}
36
				}
37
			}
38
		
31
                    }
32
                }
33
            }
39
} catch (SecurityException e) {
34
        } catch (SecurityException e) {
40
			e.printStackTrace();
35
            e.printStackTrace();
41
		} catch (IllegalArgumentException e) {
36
        } catch (IllegalArgumentException e) {
42
			e.printStackTrace();
37
            e.printStackTrace();
43
		} catch (ClassNotFoundException e) {
38
        } catch (ClassNotFoundException e) {
44
			e.printStackTrace();
39
            e.printStackTrace();
45
		} catch (InstantiationException e) {
40
        } catch (InstantiationException e) {
46
			e.printStackTrace();
41
            e.printStackTrace();
47
		} catch (IllegalAccessException e) {
42
        } catch (IllegalAccessException e) {
48
			e.printStackTrace();
43
            e.printStackTrace();
49
		} catch (InvocationTargetException e) {
44
        } catch (InvocationTargetException e) {
50
			e.printStackTrace();
45
            e.printStackTrace();
51
		} catch (NoSuchMethodException e) {
46
        } catch (NoSuchMethodException e) {
52
			e.printStackTrace();
47
            e.printStackTrace();
53
		}
54
	}
55
	
48
        }
49
    }
56
public static Test suite() {
50
    public static Test suite() {
57
		TestSuite suite = new TestSuite(
51
        TestSuite suite = new TestSuite(
58
				"Test for org.columba.mail.gui.composer.command");
52
"Test for org.columba.mail.
59
		
53
folder");
60
setup(suite, new MHFolderFactory());
54
        setup(suite, new MHFolderFactory());
61
		setup(suite, new MBOXFolderTstFactory());
55
        setup(suite, new MBOXFolderTstFactory());
62
		setup(suite, new TempFolderFactory());
56
		setup(suite, new TempFolderFactory());
63
		// disabled IMAP folder tests as they require connection
57
        // disabled IMAP folder tests as they require connection
64
		// to remote IMAP server
58
        // to remote IMAP server
65
		// setup(suite, new IMAPTstFactory());
59
        //setup(suite, new IMAPTstFactory());
66
		return suite;
60
        return suite;
67
	}
61
    }
68
}
62
}
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