예제 #1
0
 @Test
 public void simple() throws MessageException, MessagingException {
   sender.send(
       new Email("Subject", "Body", new EmailAddress("*****@*****.**"), "*****@*****.**"));
   AssertEmail.assertEquals(
       new ExpectedEmail("Subject", "Body", "*****@*****.**", "*****@*****.**"),
       greenMail.getReceivedMessages());
 }
예제 #2
0
 @Test
 public void attachment() throws MessageException, MessagingException, IOException {
   sender.send(
       new Email(
           "Subject",
           "Body",
           new EmailAddress("*****@*****.**"),
           "*****@*****.**",
           new Attachment(
               new File(getClass().getResource("/attachment/04-Java-OOP-Basics.pdf").getFile()))));
   AssertEmail.assertEquals(
       new ExpectedEmail("Subject", "Body", "*****@*****.**", "*****@*****.**"),
       greenMail.getReceivedMessages());
   AssertAttachment.assertEquals(
       new ExpectedAttachment("/attachment/04-Java-OOP-Basics.pdf", "application/pdf.*"),
       greenMail.getReceivedMessages());
 }