OSDN Git Service

書きかけのテストケースを更新
authorIwao AVE! <harawata@gmail.com>
Tue, 22 Nov 2011 17:26:19 +0000 (02:26 +0900)
committerIwao AVE! <harawata@gmail.com>
Tue, 22 Nov 2011 17:26:19 +0000 (02:26 +0900)
src/test/java/com/ozacc/mail/fetch/impl/FetchMailImplTest.java

index 3288be4..00236fe 100644 (file)
@@ -28,14 +28,16 @@ public class FetchMailImplTest extends TestCase
        }
 
        /**
-        * X-ヘッダーがない場合のテスト (#12279)
+        * 受信したメールの返信を作成するテスト (#12279)
         */
-       public void testNoXHeader() throws Exception
+       public void testReplyReceivedMail() throws Exception
        {
+               String subject = "Test subject";
+               String recipient = "info@example.com";
                Session session = Session.getInstance(System.getProperties());
                MimeMessage msg = new MimeMessage(session);
-               msg.setRecipients(RecipientType.TO, "info@example.com");
-               msg.setSubject("Test subject");
+               msg.setRecipients(RecipientType.TO, recipient);
+               msg.setSubject(subject);
                msg.setText("Test body");
                msg.setHeader("Message-ID", "MSGID-123");
                Mailbox inbox = Mailbox.get("info@example.com");
@@ -46,8 +48,9 @@ public class FetchMailImplTest extends TestCase
                fetchMail.setUsername("info");
                ReceivedMail[] mails = fetchMail.getMails();
                assertEquals(1, mails.length);
-               Mail reply = (ReceivedMail)mails[0].reply();
-               assertEquals("Test subject", reply.getSubject());
+               ReceivedMail receivedMail = mails[0];
+               Mail reply = (Mail)(receivedMail.reply());
+               assertEquals(receivedMail.getReplySubjectPrefix() + subject, reply.getSubject());
        }
 
        protected void tearDown() throws Exception {