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: void testForewardWithAttachment()
|
Method name: void testForewardWithAttachment()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | String input = FolderTstHelper.getString("0_attachment.eml");↵ | 1 | String input = FolderTstHelper.getString("0_attachment.eml");↵ | |
2 | System.out.println("input=" + input);↵ | 2 | System.out.println("input=" + input);↵ | |
3 | // create stream from string↵ | 3 | // create stream from string↵ | |
4 | InputStream inputStream =↵ | 4 | InputStream inputStream =↵ | |
5 | FolderTstHelper↵ | 5 | FolderTstHelper↵ | |
6 | .getByteArrayInputStream(input);↵ | 6 | .getByteArrayInputStream(input);↵ | |
7 | // add stream to folder↵ | 7 | // add stream to folder↵ | |
8 | Object uid = getSourceFolder().addMessage(inputStream);↵ | 8 | Object uid = getSourceFolder().addMessage(inputStream);↵ | |
9 | // create Command reference↵ | 9 | // create Command reference↵ | |
10 | MailFolderCommandReference ref = new MailFolderCommandReference(↵ | 10 | MailFolderCommandReference ref = new MailFolderCommandReference(↵ | |
11 | getSourceFolder(), new Object[] { uid });↵ | 11 | getSourceFolder(), new Object[] { uid });↵ | |
12 | // create copy command↵ | 12 | // create copy command↵ | |
13 | ForwardCommand command = new ForwardCommand(ref);↵ | 13 | ForwardInlineCommand command = new ForwardInlineCommand(ref);↵ | |
14 | // execute command -> use mock object class as worker which does↵ | 14 | // execute command -> use mock object class as worker which does↵ | |
15 | // nothing↵ | 15 | // nothing↵ | |
16 | ↵ | 16 | ↵ | |
17 | command.execute(NullWorkerStatusController.getInstance());↵ | 17 | command.execute(NullWorkerStatusController.getInstance());↵ | |
18 | // model should contain the data↵ | 18 | // model should contain the data↵ | |
19 | ComposerModel model = command.getModel();↵ | 19 | ComposerModel model = command.getModel();↵ | |
20 | List attachments = model.getAttachments();↵ | 20 | List attachments = model.getAttachments();↵ | |
21 | ↵ | 21 | ↵ | |
22 | assertEquals("There should be one attachment", 1, attachments.size());↵ | 22 | assertEquals("There should be one attachment", 1, attachments.size());↵ | |
23 | Object mimePart = attachments.get(0);↵ | 23 | Object mimePart = attachments.get(0);↵ | |
24 | assertEquals(↵ | 24 | assertEquals(↵ | |
25 | "Should be type of StreamableMimePart", true,↵ | 25 | "Should be type of StreamableMimePart",↵ | |
26 | ↵ | |||
26 | true,↵ | |||
27 | (mimePart instanceof InputStreamMimePart)); | 27 | (mimePart instanceof InputStreamMimePart)); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 86 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String input = FolderTstHelper.getString("0_attachment.eml"); | 1 | String input = FolderTstHelper.getString("0_attachment.eml"); | |||||||||||||||||||
2 | System.out.println("input=" + input); | 2 | System.out.println("input=" + input); | |||||||||||||||||||
3 | InputStream inputStream = FolderTstHelper.getByteArrayInputStream(input); | 3 | InputStream inputStream = FolderTstHelper.getByteArrayInputStream(input); | |||||||||||||||||||
4 | Object uid = getSourceFolder().addMessage(inputStream); | 4 | Object uid = getSourceFolder().addMessage(inputStream); | |||||||||||||||||||
5 | MailFolderCommandReference ref = new MailFolderCommandReference(getSourceFolder(), new Object[] {uid}); | 5 | MailFolderCommandReference ref = new MailFolderCommandReference(getSourceFolder(), new Object[] {uid}); | |||||||||||||||||||
6 | ForwardCommand command = new ForwardCommand(ref); |
| 6 | ForwardInlineCommand command = new ForwardInlineCommand(ref); | ||||||||||||||||||
7 | command.execute(NullWorkerStatusController.getInstance()); |
| 7 | command.execute(NullWorkerStatusController.getInstance()); | ||||||||||||||||||
8 | ComposerModel model = command.getModel(); |
| 8 | ComposerModel model = command.getModel(); | ||||||||||||||||||
9 | List attachments = model.getAttachments(); | 9 | List attachments = model.getAttachments(); | |||||||||||||||||||
10 | assertEquals("There should be one attachment", 1, attachments.size()); | 10 | assertEquals("There should be one attachment", 1, attachments.size()); | |||||||||||||||||||
11 | Object mimePart = attachments.get(0); | 11 | Object mimePart = attachments.get(0); | |||||||||||||||||||
12 | assertEquals("Should be type of StreamableMimePart", true, (mimePart instanceof InputStreamMimePart)); | 12 | assertEquals("Should be type of StreamableMimePart", true, (mimePart instanceof InputStreamMimePart)); |
Row | Violation |
---|---|
1 | Expression new ForwardCommand(ref) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new ForwardInlineCommand(ref) cannot be parameterized, because it has dependencies to/from statements that will be extracted |