public HtmlEmail createEmail(T report) throws MalformedURLException, EmailException {
    HtmlEmail email = new HtmlEmail();

    setEmailSettings(email);
    addReportContent(email, report);

    return email;
  }
@Test
  public void test_email_fields() throws Exception {
    BasicEmail basicEmail = new BasicEmail(Set.of("noreply@nowhere"));
    when(emailSettings.getSmtpHost()).thenReturn("smtphost");
    when(emailSettings.getSmtpPort()).thenReturn(25);
    when(emailSettings.getFrom()).thenReturn("noreply@nowhere");
    when(emailSettings.getFromName()).thenReturn("My SonarQube");
    when(emailSettings.getPrefix()).thenReturn("[SONAR]");
    when(emailSettings.getSmtpUsername()).thenReturn("");
    when(emailSettings.getSmtpPassword()).thenReturn("");

    MultiPartEmail email = sender.createEmail(basicEmail);

    assertThat(email.getHostName()).isEqualTo("smtphost");
    assertThat(email.getSmtpPort()).isEqualTo("25");
    assertThat(email.getSubject()).isEqualTo("Email Subject");
    assertThat(email.getFromAddress()).hasToString("My SonarQube <noreply@nowhere>");
    assertThat(email.getToAddresses()).isEmpty();
    assertThat(email.getCcAddresses()).isEmpty();

    assertThat(email.isSSLOnConnect()).isFalse();
    assertThat(email.isStartTLSEnabled()).isFalse();
    assertThat(email.isStartTLSRequired()).isFalse();
  }