Last active
October 4, 2015 09:27
-
-
Save sunitparekh/0683cdc1e58596c9bc87 to your computer and use it in GitHub Desktop.
Sample Email Test using Dumbster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.dumbster.smtp.SimpleSmtpServer; | |
import com.dumbster.smtp.SmtpMessage; | |
import org.junit.Test; | |
import static org.hamcrest.Matchers.equalTo; | |
import static org.junit.Assert.assertThat; | |
public class TestEmail { | |
@Test | |
public void testSend() { | |
SimpleSmtpServer server = SimpleSmtpServer.start(); | |
sendMessage("Subject", "Test Body", "[email protected]"); | |
server.stop(); | |
assertThat(server.getReceivedEmailSize(),equalTo(1)); | |
SmtpMessage email = (SmtpMessage) server.getReceivedEmail().next(); | |
assertThat(email.getHeaderValue("Subject"),equalTo("Subject")); | |
assertThat(email.getBody(),equalTo("Test Body")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment