@Test public void no_noreply_set_is_also_not_in_message() { when(mockedConfiguration.getEmailReplyTo()).thenReturn(null); SimpleMailMessage message = factoryToTest.createMessage("subject1"); assertEquals(null, message.getReplyTo()); }
public SimpleMailMessage createMessage(String subject) { String emailReplyTo = configuration.getEmailReplyTo(); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(configuration.getEmailFrom()); if (isEmpty(emailReplyTo)) { message.setReplyTo(emailReplyTo); } message.setSubject(subject); message.setSentDate(new Date()); return message; }
MailMessageFactory { public SimpleMailMessage createMessage(String subject) { String emailReplyTo = configuration.getEmailReplyTo(); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(configuration.getEmailFrom()); if (isEmpty(emailReplyTo)) { message.setReplyTo(emailReplyTo); } message.setSubject(subject); message.setSentDate(new Date()); return message; } }
MailMessageFactory { public SimpleMailMessage createMessage(String subject) { String emailReplyTo = configuration.getEmailReplyTo(); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(configuration.getEmailFrom()); if (isEmpty(emailReplyTo)) { message.setReplyTo(emailReplyTo); } message.setSubject(subject); message.setSentDate(new Date()); return message; }  }
MailMessageFactory { public SimpleMailMessage createMessage(String subject) { String emailReplyTo = configuration.getEmailReplyTo(); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(configuration.getEmailFrom()); if (isEmpty(emailReplyTo)) { message.setReplyTo(emailReplyTo); } message.setSubject(subject); message.setSentDate(new Date()); return message; }  SimpleMailMessage createMessage(String subject); }
MailMessageFactory { public SimpleMailMessage createMessage(String subject) { String emailReplyTo = configuration.getEmailReplyTo(); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(configuration.getEmailFrom()); if (isEmpty(emailReplyTo)) { message.setReplyTo(emailReplyTo); } message.setSubject(subject); message.setSentDate(new Date()); return message; }  SimpleMailMessage createMessage(String subject);  }