### Question:
OggExtractor implements Extractor { @Override public boolean sniff(ExtractorInput input) throws IOException, InterruptedException { try { return sniffInternal(input); } catch (ParserException e) { return false; } }  @Override boolean sniff(ExtractorInput input); @Override void init(ExtractorOutput output); @Override void seek(long position, long timeUs); @Override void release(); @Override int read(ExtractorInput input, PositionHolder seekPosition); static final ExtractorsFactory FACTORY; }### Answer:
@Test public void testSniffVorbis() throws Exception { byte[] data = TestUtil.joinByteArrays( OggTestData.buildOggHeader(0x02, 0, 1000, 1), TestUtil.createByteArray(7), new byte[] {0x01, 'v', 'o', 'r', 'b', 'i', 's'}); assertThat(sniff(data)).isTrue(); }
@Test public void testSniffFlac() throws Exception { byte[] data = TestUtil.joinByteArrays( OggTestData.buildOggHeader(0x02, 0, 1000, 1), TestUtil.createByteArray(5), new byte[] {0x7F, 'F', 'L', 'A', 'C'}); assertThat(sniff(data)).isTrue(); }
@Test public void testSniffFailsOpusFile() throws Exception { byte[] data = TestUtil.joinByteArrays( OggTestData.buildOggHeader(0x02, 0, 1000, 0x00), new byte[] {'O', 'p', 'u', 's'}); assertThat(sniff(data)).isFalse(); }
@Test public void testSniffFailsInvalidOggHeader() throws Exception { byte[] data = OggTestData.buildOggHeader(0x00, 0, 1000, 0x00); assertThat(sniff(data)).isFalse(); }
@Test public void testSniffInvalidHeader() throws Exception { byte[] data = TestUtil.joinByteArrays( OggTestData.buildOggHeader(0x02, 0, 1000, 1), TestUtil.createByteArray(7), new byte[] {0x7F, 'X', 'o', 'r', 'b', 'i', 's'}); assertThat(sniff(data)).isFalse(); }
@Test public void testSniffFailsEOF() throws Exception { byte[] data = OggTestData.buildOggHeader(0x02, 0, 1000, 0x00); assertThat(sniff(data)).isFalse(); }