@Test
public void readMetadataBlock_vorbisCommentBlock_updatesStreamMetadata() throws Exception {

  ExtractorInput input = buildExtractorInput("flac/bear_with_vorbis_comments.flac");
  // Skip to Vorbis comment block.
  input.skipFully(640);
  FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
  long originalSampleRate = metadataHolder.flacStreamMetadata.sampleRate;
  FlacMetadataReader.readMetadataBlock(input, metadataHolder);
  assertThat(metadataHolder.flacStreamMetadata).isNotNull();
  // Check that metadata passed has not been erased.
  assertThat(metadataHolder.flacStreamMetadata.sampleRate).isEqualTo(originalSampleRate);
  Metadata metadata =
      metadataHolder.flacStreamMetadata.getMetadataCopyWithAppendedEntriesFrom(null);
  assertThat(metadata).isNotNull();
  VorbisComment vorbisComment = (VorbisComment) metadata.get(0);
  assertThat(vorbisComment.key).isEqualTo("TITLE");
  assertThat(vorbisComment.value).isEqualTo("test title");
}