### Question:
MailServiceImpl implements MailService { protected void sendHtmlTextEmail(final String sender, final String recipient, final String subject, final String body) { validateEmail(sender); validateEmail(recipient); Preconditions.checkArgument(StringUtils.isNotBlank(subject), "e-mail subject should not be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(body), "e-mail body should not be blank"); MimeMessage mimeMessage = mailSender.createMimeMessage(); MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage); try { mimeMessageHelper.setFrom(sender); mimeMessageHelper.setTo(recipient); mimeMessageHelper.setSubject(subject); mimeMessageHelper.setText(body, true); } catch (MessagingException e) { throw new MailPreparationException(e); } mailSender.send(mimeMessage); }  @Override void sendEmail(final String recipient, final String subject, final String body); static boolean isValidEmail(final String email);  }### Answer:
@Test(expected = InvalidMailAddressException.class) public final void shouldThrowExceptionIfSenderIsNull() throws Exception { mailServiceImpl.sendHtmlTextEmail(null, DEFAULT_RECIPIENT, DEFAULT_SUBJECT, DEFAULT_BODY); }
@Test(expected = InvalidMailAddressException.class) public final void shouldThrowExceptionIfSenderIsEmpty() throws Exception { mailServiceImpl.sendHtmlTextEmail("", DEFAULT_RECIPIENT, DEFAULT_SUBJECT, DEFAULT_BODY); }
@Test(expected = InvalidMailAddressException.class) public final void shouldThrowExceptionIfSenderIsBlank() throws Exception { mailServiceImpl.sendHtmlTextEmail(" ", DEFAULT_RECIPIENT, DEFAULT_SUBJECT, DEFAULT_BODY); }
@Test(expected = InvalidMailAddressException.class) public final void shouldThrowExceptionIfSenderIsNotValid() throws Exception { mailServiceImpl.sendHtmlTextEmail("invalid", DEFAULT_RECIPIENT, DEFAULT_SUBJECT, DEFAULT_BODY); }