@Test
public void testPeekFully() throws Exception {

  DefaultExtractorInput input = createDefaultExtractorInput();
  byte[] target = new byte[TEST_DATA.length];
  input.peekFully(target, 0, TEST_DATA.length);
  // Check that we read the whole of TEST_DATA.
  assertThat(TEST_DATA).isEqualTo(target);
  assertThat(input.getPosition()).isEqualTo(0);
  assertThat(input.getPeekPosition()).isEqualTo(TEST_DATA.length);
  // Check that we can read again from the buffer
  byte[] target2 = new byte[TEST_DATA.length];
  input.readFully(target2, 0, TEST_DATA.length);
  assertThat(TEST_DATA).isEqualTo(target2);
  assertThat(input.getPosition()).isEqualTo(TEST_DATA.length);
  assertThat(input.getPeekPosition()).isEqualTo(TEST_DATA.length);
  // Check that we fail with EOFException if we peek again
  try {
    input.peekFully(target, 0, 1);
    fail();
  } catch (EOFException e) {
    // Expected.
  }
}