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 |
|