### Question:
SampleQueue implements TrackOutput { public int advanceToEnd() { return metadataQueue.advanceToEnd(); } SampleQueue(Allocator allocator); void reset(); void reset(boolean resetUpstreamFormat); void sourceId(int sourceId); void splice(); int getWriteIndex(); void discardUpstreamSamples(int discardFromIndex); boolean hasNextSample(); int getFirstIndex(); int getReadIndex(); int peekSourceId(); Format getUpstreamFormat(); long getLargestQueuedTimestampUs(); boolean isLastSampleQueued(); long getFirstTimestampUs(); void rewind(); void discardTo(long timeUs, boolean toKeyframe, boolean stopAtReadPosition); void discardToRead(); void discardToEnd(); int advanceToEnd(); int advanceTo(long timeUs, boolean toKeyframe, boolean allowTimeBeyondBuffer); boolean setReadPosition(int sampleIndex); int read(
      FormatHolder formatHolder,
      DecoderInputBuffer buffer,
      boolean formatRequired,
      boolean loadingFinished,
      long decodeOnlyUntilUs); void setUpstreamFormatChangeListener(UpstreamFormatChangedListener listener); void setSampleOffsetUs(long sampleOffsetUs); @Override void format(Format format); @Override int sampleData(ExtractorInput input, int length, boolean allowEndOfInput); @Override void sampleData(ParsableByteArray buffer, int length); @Override void sampleMetadata(
      long timeUs,
      @C.BufferFlags int flags,
      int size,
      int offset,
      @Nullable CryptoData cryptoData); static final int ADVANCE_FAILED; }### Answer:
@Test public void testAdvanceToEnd() { writeTestData(); sampleQueue.advanceToEnd(); assertAllocationCount(10); sampleQueue.discardToRead(); assertAllocationCount(0); assertReadFormat(false, FORMAT_2); assertNoSamplesToRead(FORMAT_2); }