@Test public void simple() throws MessageException, MessagingException { sender.send( new Email("Subject", "Body", new EmailAddress("*****@*****.**"), "*****@*****.**")); AssertEmail.assertEquals( new ExpectedEmail("Subject", "Body", "*****@*****.**", "*****@*****.**"), greenMail.getReceivedMessages()); }
@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()); }