Skip to content

Instantly share code, notes, and snippets.

@AlfredoCasado
Created December 2, 2010 12:20
Show Gist options
  • Save AlfredoCasado/725201 to your computer and use it in GitHub Desktop.
Save AlfredoCasado/725201 to your computer and use it in GitHub Desktop.
public class EmailNotifierTest {
static final String TEST_BODY = "cuerpo de test";
static final String TEST_SUBJECT = "asunto de test";
final MailAdress alfredo = new MailAdress("[email protected]");
final EmailNotifier emailNotifier = new EmailNotifier();
@Test
public void shouldSendOneEmailToTheGivenEmailAdress() throws Exception {
Message aTestMessage = createATestMessage();
emailNotifier.sendTo(alfredo, aTestMessage);
assertThat(inboxOf(alfredo), hasOneEmailWithSubject(TEST_SUBJECT));
}
private Message createATestMessage() {
Message aTestMessage = mock(Message.class);
when(aTestMessage.subject()).thenReturn(TEST_SUBJECT);
when(aTestMessage.body()).thenReturn(TEST_BODY);
return aTestMessage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment