@Override
  public void publish(ScannerReportWriter writer) {
    List<DefaultAnalysisWarnings.Message> warnings = defaultAnalysisWarnings.warnings();
    if (warnings.isEmpty()) {
      return;
    }
    writer.writeAnalysisWarnings(warnings.stream()
      .map(AnalysisWarningsPublisher::toProtobufAnalysisWarning)
      .toList());
  }
@Test
  public void do_not_write_warnings_report_when_empty() throws IOException {
    File outputDir = temp.newFolder();
    ScannerReportWriter writer = new ScannerReportWriter(fileStructure);

    underTest.publish(writer);

    assertThat(writer.getFileStructure().analysisWarnings()).doesNotExist();

    ScannerReportReader reader = new ScannerReportReader(fileStructure);
    List<ScannerReport.AnalysisWarning> warnings = Lists.newArrayList(reader.readAnalysisWarnings());

    assertThat(warnings).isEmpty();
  }