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 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 void testForewardWithAttachment() throws Exception {
1
public void testForewardWithAttachment() throws Exception {
2
		String input = FolderTstHelper.getString("0_attachment.eml");
2
        String input = FolderTstHelper.getString("0_attachment.eml");
3
		System.out.println("input=" + input);
3
        System.out.println("input=" + input);
4
		// create stream from string
4
        // create stream from string
5
		InputStream inputStream =
5
        InputStream inputStream =
6
 FolderTstHelper
6
            FolderTstHelper
7
				.getByteArrayInputStream(input);
7
.getByteArrayInputStream(input);
8
		// add stream to folder
8
        // add stream to folder
9
		Object uid = getSourceFolder().addMessage(inputStream);
9
        Object uid = getSourceFolder().addMessage(inputStream);
10
//		 create Command reference
10
//      create Command reference
11
		MailFolderCommandReference ref = new MailFolderCommandReference(
11
        MailFolderCommandReference ref = new MailFolderCommandReference(
12
				getSourceFolder(), new Object[] { uid });
12
				getSourceFolder(), new Object[] { uid });
13
		// create copy command
13
        // create copy command
14
		ForwardCommand command = new ForwardCommand(ref);
14
        ForwardInlineCommand command = new ForwardInlineCommand(ref);
15
		//  execute command -> use mock object class as worker which does
15
        //  execute command -> use mock object class as worker which does
16
		// nothing
16
        // nothing
17
		
17
 
18
command.execute(NullWorkerStatusController.getInstance());
18
        command.execute(NullWorkerStatusController.getInstance());
19
		// model should contain the data
19
        // model should contain the data
20
		ComposerModel model = command.getModel();
20
        ComposerModel model = command.getModel();
21
		List attachments = model.getAttachments();
21
        List attachments = model.getAttachments();
22
		
22
 
23
assertEquals("There should be one attachment", 1, attachments.size());
23
        assertEquals("There should be one attachment", 1, attachments.size());
24
		Object mimePart = attachments.get(0);
24
        Object mimePart = attachments.get(0);
25
		assertEquals(
25
        assertEquals(
26
"Should be type of StreamableMimePart", true,
26
            "Should be type of StreamableMimePart",
27
				
27
            true,
28
(mimePart instanceof InputStreamMimePart));
28
            (mimePart instanceof InputStreamMimePart));
29
           
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