@Override
  public ScannerReport.Metadata readMetadata() {
    ensureInitialized();
    if (this.metadata == null) {
      this.metadata = delegate.readMetadata();
    }
    return this.metadata;
  }
@Test
  public void readMetadata_result_is_cached() {
    ScannerReport.Metadata metadata = ScannerReport.Metadata.newBuilder().build();

    writer.writeMetadata(metadata);

    ScannerReport.Metadata res = underTest.readMetadata();
    assertThat(res).isEqualTo(metadata);
    assertThat(underTest.readMetadata()).isSameAs(res);
  }