@Override
  public void publish() {
    checkNotPublished();
    if (!metadataWritten.get()) {
      throw new IllegalStateException("Metadata is missing");
    }
    File zip = tempFolder.newFile();
    FILES2.zipDir(rootDir, zip);

    File targetZip = projectExportDumpFS.exportDumpOf(descriptor);
    FILES2.deleteIfExists(targetZip);
    FILES2.moveFile(zip, targetZip);
    FILES2.deleteIfExists(rootDir);
    LoggerFactory.getLogger(getClass()).info("Dump file published | size={} | path={}", humanReadableByteCountSI(sizeOf(targetZip)), targetZip.getAbsolutePath());
    published.set(true);
  }
@Test
  public void publish_fails_if_metadata_is_missing() {
    assertThatThrownBy(() -> underTest.publish())
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Metadata is missing");
  }