@Test
  public void log_and_dump_information_about_report_uploading() throws IOException {
    ReportPublisher underTest =
        new ReportPublisher(
            settings,
            wsClient,
            server,
            contextPublisher,
            reactor,
            mode,
            mock(TempFolder.class),
            new ReportPublisherStep[0]);

    underTest.logSuccess("TASK-123");

    assertThat(logTester.logs(LoggerLevel.INFO))
        .contains("ANALYSIS SUCCESSFUL, you can browse https://localhost/dashboard/index/struts")
        .contains(
            "Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report")
        .contains("More about the report processing at https://localhost/api/ce/task?id=TASK-123");

    File detailsFile = new File(temp.getRoot(), "report-task.txt");
    assertThat(readFileToString(detailsFile))
        .isEqualTo(
            "projectKey=struts\n"
                + "serverUrl=https://localhost\n"
                + "dashboardUrl=https://localhost/dashboard/index/struts\n"
                + "ceTaskId=TASK-123\n"
                + "ceTaskUrl=https://localhost/api/ce/task?id=TASK-123\n");
  }
  @Test
  public void log_public_url_if_defined() throws IOException {
    when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
    ReportPublisher underTest =
        new ReportPublisher(
            settings,
            wsClient,
            server,
            contextPublisher,
            reactor,
            mode,
            mock(TempFolder.class),
            new ReportPublisherStep[0]);

    underTest.logSuccess("TASK-123");

    assertThat(logTester.logs(LoggerLevel.INFO))
        .contains(
            "ANALYSIS SUCCESSFUL, you can browse https://publicserver/sonarqube/dashboard/index/struts")
        .contains(
            "More about the report processing at https://publicserver/sonarqube/api/ce/task?id=TASK-123");

    File detailsFile = new File(temp.getRoot(), "report-task.txt");
    assertThat(readFileToString(detailsFile))
        .isEqualTo(
            "projectKey=struts\n"
                + "serverUrl=https://publicserver/sonarqube\n"
                + "dashboardUrl=https://publicserver/sonarqube/dashboard/index/struts\n"
                + "ceTaskId=TASK-123\n"
                + "ceTaskUrl=https://publicserver/sonarqube/api/ce/task?id=TASK-123\n");
  }
  @Test
  public void log_but_not_dump_information_when_report_is_not_uploaded() {
    ReportPublisher underTest =
        new ReportPublisher(
            settings,
            wsClient,
            server,
            contextPublisher,
            reactor,
            mode,
            mock(TempFolder.class),
            new ReportPublisherStep[0]);

    underTest.logSuccess(/* report not uploaded, no server task */ null);

    assertThat(logTester.logs(LoggerLevel.INFO))
        .contains("ANALYSIS SUCCESSFUL")
        .doesNotContain("dashboard/index");

    File detailsFile = new File(temp.getRoot(), ReportPublisher.METADATA_DUMP_FILENAME);
    assertThat(detailsFile).doesNotExist();
  }