Skip to content

Instantly share code, notes, and snippets.

@mismatch
Created July 12, 2013 18:26
Show Gist options
  • Save mismatch/5986667 to your computer and use it in GitHub Desktop.
Save mismatch/5986667 to your computer and use it in GitHub Desktop.
Wiser vs Dumbster. Test 2
public class EmailerViaDumbsterTest extends EmailerTest {
private SimpleSmtpServer dumbster;
private Emailer emailer;
@Before
public void setUp() throws Exception {
emailer = new Emailer(config);
dumbster = SimpleSmtpServer.start(smtpPort);
}
@After
public void tearDown() throws Exception {
dumbster.stop();
}
@Test
public void test() {
String subject = "There are new comments";
String body = "Hello, Test!";
emailer.sendEmail("yourhost", "testuser@yandex.ru", subject, body);
assertEquals(1, dumbster.getReceivedEmailSize());
SmtpMessage email = (SmtpMessage)dumbster.getReceivedEmail().next();
assertTrue(email.getHeaderValue("Subject").equals(subject));
assertTrue(email.getBody().equals(body));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment