1 package org.columba.mail.gui.composer.command; 19 20 import java.io.InputStream ; 21 import java.util.List ; 22 23 import org.columba.core.command.NullWorkerStatusController; 24 import org.columba.mail.command.MailFolderCommandReference; 25 import org.columba.mail.folder.FolderTstHelper; 26 import org.columba.mail.folder.MailboxTstFactory; 27 import org.columba.mail.gui.composer.ComposerModel; 28 import org.columba.ristretto.message.InputStreamMimePart; 29 30 34 public class ForwardInlineCommandTest extends AbstractComposerTst { 35 36 public ForwardInlineCommandTest(String arg0) { 37 super(arg0); 38 39 } 40 41 44 public ForwardInlineCommandTest(MailboxTstFactory factory, String arg0) { 45 super(factory, arg0); 46 } 47 48 public void test() throws Exception { 49 50 String input = FolderTstHelper.getString(0); 52 System.out.println("input=" + input); 53 InputStream inputStream = FolderTstHelper 55 .getByteArrayInputStream(input); 56 Object uid = getSourceFolder().addMessage(inputStream); 58 59 MailFolderCommandReference ref = new MailFolderCommandReference( 61 getSourceFolder(), new Object [] { uid }); 62 63 ForwardInlineCommand command = new ForwardInlineCommand(ref); 65 66 command.execute(NullWorkerStatusController.getInstance()); 69 70 ComposerModel model = command.getModel(); 72 73 String subject = model.getSubject(); 74 75 assertEquals("Subject", "Fwd: test", subject); 76 } 77 78 public void testForewardWithAttachment() throws Exception { 79 String input = FolderTstHelper.getString("0_attachment.eml"); 80 System.out.println("input=" + input); 81 InputStream inputStream = 83 FolderTstHelper.getByteArrayInputStream(input); 84 Object uid = getSourceFolder().addMessage(inputStream); 86 MailFolderCommandReference ref = new MailFolderCommandReference( 88 getSourceFolder(), new Object [] { uid }); 89 ForwardInlineCommand command = new ForwardInlineCommand(ref); 91 command.execute(NullWorkerStatusController.getInstance()); 94 ComposerModel model = command.getModel(); 96 List attachments = model.getAttachments(); 97 98 assertEquals("There should be one attachment", 1, attachments.size()); 99 Object mimePart = attachments.get(0); 100 assertEquals( 101 "Should be type of StreamableMimePart", 102 true, 103 (mimePart instanceof InputStreamMimePart)); 104 105 106 } 107 108 } | Popular Tags |