public class ForwardCommandTest extends AbstractComposerTst { public ForwardCommandTest(String arg0) { super(arg0); } /** * @param arg0 */ public ForwardCommandTest(MailboxTstFactory factory, String arg0) { super(factory, arg0); } public void test() throws Exception { // add message "0.eml" as inputstream to folder String input = FolderTstHelper.getString(0); System.out.println("input=" + input); // create stream from string InputStream inputStream = FolderTstHelper .getByteArrayInputStream(input); // add stream to folder Object uid = getSourceFolder().addMessage(inputStream); // create Command reference MailFolderCommandReference ref = new MailFolderCommandReference( getSourceFolder(), new Object[] { uid }); // create copy command ForwardCommand command = new ForwardCommand(ref); // execute command -> use mock object class as worker which does // nothing command.execute(NullWorkerStatusController.getInstance()); // model should contain the data ComposerModel model = command.getModel(); String subject = model.getSubject(); assertEquals("Subject", "Fwd: test", subject); } public void testForewardWithAttachment() throws Exception { String input = FolderTstHelper.getString("0_attachment.eml"); System.out.println("input=" + input); // create stream from string InputStream inputStream = FolderTstHelper .getByteArrayInputStream(input); // add stream to folder Object uid = getSourceFolder().addMessage(inputStream); // create Command reference MailFolderCommandReference ref = new MailFolderCommandReference( getSourceFolder(), new Object[] { uid }); // create copy command ForwardCommand command = new ForwardCommand(ref); // execute command -> use mock object class as worker which does // nothing command.execute(NullWorkerStatusController.getInstance()); // model should contain the data ComposerModel model = command.getModel(); List attachments = model.getAttachments(); assertEquals("There should be one attachment", 1, attachments.size()); Object mimePart = attachments.get(0); assertEquals("Should be type of StreamableMimePart", true, (mimePart instanceof InputStreamMimePart))
public class ForwardInlineCommandTest extends AbstractComposerTst { public ForwardInlineCommandTest(String arg0) { super(arg0); } /** * @param arg0 */ public ForwardInlineCommandTest(MailboxTstFactory factory, String arg0) { super(factory, arg0); } public void test() throws Exception { // add message "0.eml" as inputstream to folder String input = FolderTstHelper.getString(0); System.out.println("input=" + input); // create stream from string InputStream inputStream = FolderTstHelper .getByteArrayInputStream(input); // add stream to folder Object uid = getSourceFolder().addMessage(inputStream); // create Command reference MailFolderCommandReference ref = new MailFolderCommandReference( getSourceFolder(), new Object[] { uid }); // create copy command ForwardInlineCommand command = new ForwardInlineCommand(ref); // execute command -> use mock object class as worker which does // nothing command.execute(NullWorkerStatusController.getInstance()); // model should contain the data ComposerModel model = command.getModel(); String subject = model.getSubject(); assertEquals("Subject", "Fwd: test", subject); } public void testForewardWithAttachment() throws Exception { String input = FolderTstHelper.getString("0_attachment.eml"); System.out.println("input=" + input); // create stream from string InputStream inputStream = FolderTstHelper.getByteArrayInputStream(input); // add stream to folder Object uid = getSourceFolder().addMessage(inputStream); // create Command reference MailFolderCommandReference ref = new MailFolderCommandReference( getSourceFolder(), new Object[] { uid }); // create copy command ForwardInlineCommand command = new ForwardInlineCommand(ref); // execute command -> use mock object class as worker which does // nothing command.execute(NullWorkerStatusController.getInstance()); // model should contain the data ComposerModel model = command.getModel(); List attachments = model.getAttachments(); assertEquals("There should be one attachment", 1, attachments.size()); Object mimePart = attachments.get(0); assertEquals( "Should be type of StreamableMimePart", true, (mimePart instanceof InputStreamMimePart))
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/gui/composer/command/ForwardCommandTest.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/gui/composer/command/ForwardInlineCommandTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class ForwardCommandTest extends AbstractComposerTst {
1
public class ForwardInlineCommandTest extends AbstractComposerTst {
2
	public ForwardCommandTest(String arg0) {
2
    public ForwardInlineCommandTest(String arg0) {
3
		super(arg0);
3
        super(arg0);
4
	}
5
	/**
6
	
4
        
5
    }
6
    
7
    /**
7
 * @param arg0
8
     * @param arg0
8
	 */
9
	
9
     */
10
public ForwardCommandTest(MailboxTstFactory factory, String arg0) {
10
    public ForwardInlineCommandTest(MailboxTstFactory factory, String arg0) {
11
		super(factory, arg0);
11
        super(factory, arg0);
12
	}
13
	
12
    }
14
public void test() throws Exception {
13
    public void test() throws Exception {
15
		// add message "0.eml" as inputstream to folder
14
        // add message "0.eml" as inputstream to folder
16
		String input = FolderTstHelper.getString(0);
15
        String input = FolderTstHelper.getString(0);
17
		System.out.println("input=" + input);
16
        System.out.println("input=" + input);
18
		// create stream from string
17
        // create stream from string
19
		InputStream inputStream = FolderTstHelper
18
        InputStream inputStream = FolderTstHelper
20
				.getByteArrayInputStream(input);
19
                .getByteArrayInputStream(input);
21
		// add stream to folder
20
        // add stream to folder
22
		Object uid = getSourceFolder().addMessage(inputStream);
21
        Object uid = getSourceFolder().addMessage(inputStream);
23
		// create Command reference
22
//      create Command reference
24
		MailFolderCommandReference ref = new MailFolderCommandReference(
23
        MailFolderCommandReference ref = new MailFolderCommandReference(
25
				getSourceFolder(), new Object[] { uid });
24
				getSourceFolder(), new Object[] { uid });
26
		// create copy command
25
        // create copy command
27
		ForwardCommand command = new ForwardCommand(ref);
26
        ForwardInlineCommand command = new ForwardInlineCommand(ref);
28
		// execute command -> use mock object class as worker which does
27
        // execute command -> use mock object class as worker which does
29
		// nothing
28
        // nothing
30
		command.execute(NullWorkerStatusController.getInstance());
29
        command.execute(NullWorkerStatusController.getInstance());
31
		// model should contain the data
30
        // model should contain the data
32
		ComposerModel model = command.getModel();
31
        ComposerModel model = command.getModel();
33
		String subject = model.getSubject();
32
        String subject = model.getSubject();
34
		assertEquals("Subject", "Fwd: test", subject);
33
        assertEquals("Subject", "Fwd: test", subject);
35
	}
36
	
34
    }
35
    
37
public void testForewardWithAttachment() throws Exception {
36
    public void testForewardWithAttachment() throws Exception {
38
		String input = FolderTstHelper.getString("0_attachment.eml");
37
        String input = FolderTstHelper.getString("0_attachment.eml");
39
		System.out.println("input=" + input);
38
        System.out.println("input=" + input);
40
		// create stream from string
39
        // create stream from string
41
		InputStream inputStream =
40
        InputStream inputStream =
42
 FolderTstHelper
41
            FolderTstHelper
43
				.getByteArrayInputStream(input);
42
.getByteArrayInputStream(input);
44
		// add stream to folder
43
        // add stream to folder
45
		Object uid = getSourceFolder().addMessage(inputStream);
44
        Object uid = getSourceFolder().addMessage(inputStream);
46
//		 create Command reference
45
//      create Command reference
47
		MailFolderCommandReference ref = new MailFolderCommandReference(
46
        MailFolderCommandReference ref = new MailFolderCommandReference(
48
				getSourceFolder(), new Object[] { uid });
47
				getSourceFolder(), new Object[] { uid });
49
		// create copy command
48
        // create copy command
50
		ForwardCommand command = new ForwardCommand(ref);
49
        ForwardInlineCommand command = new ForwardInlineCommand(ref);
51
		//  execute command -> use mock object class as worker which does
50
        //  execute command -> use mock object class as worker which does
52
		// nothing
51
        // nothing
53
		
52
 
54
command.execute(NullWorkerStatusController.getInstance());
53
        command.execute(NullWorkerStatusController.getInstance());
55
		// model should contain the data
54
        // model should contain the data
56
		ComposerModel model = command.getModel();
55
        ComposerModel model = command.getModel();
57
		List attachments = model.getAttachments();
56
        List attachments = model.getAttachments();
58
		
57
 
59
assertEquals("There should be one attachment", 1, attachments.size());
58
        assertEquals("There should be one attachment", 1, attachments.size());
60
		Object mimePart = attachments.get(0);
59
        Object mimePart = attachments.get(0);
61
		assertEquals(
60
        assertEquals(
62
"Should be type of StreamableMimePart", true,
61
            "Should be type of StreamableMimePart",
63
				
62
            true,
64
(mimePart instanceof InputStreamMimePart))
63
            (mimePart instanceof InputStreamMimePart))
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