Created
July 12, 2013 18:26
-
-
Save mismatch/5986667 to your computer and use it in GitHub Desktop.
Wiser vs Dumbster. Test 2
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
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