@Test
public void testDiscardToEnd() {

  writeTestData();
  // Should discard everything.
  sampleQueue.discardToEnd();
  assertThat(sampleQueue.getFirstIndex()).isEqualTo(8);
  assertThat(sampleQueue.getReadIndex()).isEqualTo(8);
  assertAllocationCount(0);
  // We should still be able to read the upstream format.
  assertReadFormat(false, FORMAT_2);
  // We should be able to write and read subsequent samples.
  writeTestData();
  assertReadTestData(FORMAT_2);
}