public void sendTestEmail(String toAddress, String subject, String message) throws EmailException {
    try {
      EmailMessage emailMessage = new EmailMessage();
      emailMessage.setTo(toAddress);
      emailMessage.setSubject(subject);
      emailMessage.setPlainTextMessage(message + getServerBaseUrlFooter());
      send(emailMessage);
    } catch (EmailException e) {
      LOG.debug("Fail to send test email to {}: {}", toAddress, e);
      throw e;
    }
  }
@Test
  public void sendTestEmailShouldSanitizeLog() throws Exception {
    logTester.setLevel(LoggerLevel.TRACE);
    configure();
    underTest.sendTestEmail("user@nowhere", "Test Message from SonarQube", "This is a message \n containing line breaks \r that should be sanitized when logged.");

    assertThat(logTester.logs(Level.TRACE)).isNotEmpty()
      .contains("Sending email: This is a message _ containing line breaks _ that should be sanitized when logged.__Mail sent from: http://nemo.sonarsource.org");

  }