jizzEmailServices = new JizzEmailServicesImpl(mockEmailRenderer);
}
@Test
public void testConfirmEmailAddress() {
JizzStation mockStation = new JizzStation();
mockStation.setSmtpServerHost("localhost");
mockStation.setSmtpServerPort(SMTP_TEST_PORT);
mockStation.setUrl("http://test.jizz.com/jizz/");
JizzDj mockDj = new JizzDj();
mockDj.setStation(mockStation);
mockDj.setLocale("en");
mockDj.setName("Test");
mockDj.setEmail("test@test.com");
mockDj.setEmailConfirmation("123456");
JizzEmailResponse mockEmailResponse = new JizzEmailResponse() {
@Override
public String getSubject() {
return "Test Confirmation";
}
@Override
public String getPlainText() {
return "Test Plain Text Message";
}
@Override
public String getHtml() {
return "<h1>Test HTML Message</h1>";
}
};
expect(
mockEmailRenderer.generateConfirmAddressEmail(
Locale.forLanguageTag(mockDj.getLocale()),
mockStation,
mockDj,
mockStation.getUrl() + "confirm?key="
+ mockDj.getEmailConfirmation())).andReturn(
mockEmailResponse);
SimpleSmtpServer smtp = SimpleSmtpServer.start(mockStation
.getSmtpServerPort());
replay(mockEmailRenderer);
jizzEmailServices.confirmEmailAddress(mockDj);
smtp.stop();
verify(mockEmailRenderer);