diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/ExtractorAsserts.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/ExtractorAsserts.java index dff69c1e0b..269a99269c 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/ExtractorAsserts.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/ExtractorAsserts.java @@ -236,86 +236,6 @@ public final class ExtractorAsserts { return extractorOutput; } - /** - * Calls {@link #assertThrows(Extractor, byte[], Class, boolean, boolean, boolean)} with all - * possible combinations of "simulate" parameters. - * - * @param factory An {@link ExtractorFactory} which creates instances of the {@link Extractor} - * class which is to be tested. - * @param sampleFile The path to the input sample. - * @param context To be used to load the sample file. - * @param expectedThrowable Expected {@link Throwable} class. - * @throws IOException If reading from the input fails. - * @see #assertThrows(Extractor, byte[], Class, boolean, boolean, boolean) - */ - public static void assertThrows( - ExtractorFactory factory, - String sampleFile, - Context context, - Class expectedThrowable) - throws IOException { - byte[] fileData = TestUtil.getByteArray(context, sampleFile); - assertThrows(factory, fileData, expectedThrowable); - } - - /** - * Calls {@link #assertThrows(Extractor, byte[], Class, boolean, boolean, boolean)} with all - * possible combinations of "simulate" parameters. - * - * @param factory An {@link ExtractorFactory} which creates instances of the {@link Extractor} - * class which is to be tested. - * @param fileData Content of the input file. - * @param expectedThrowable Expected {@link Throwable} class. - * @throws IOException If reading from the input fails. - * @see #assertThrows(Extractor, byte[], Class, boolean, boolean, boolean) - */ - private static void assertThrows( - ExtractorFactory factory, byte[] fileData, Class expectedThrowable) - throws IOException { - assertThrows(factory.create(), fileData, expectedThrowable, false, false, false); - assertThrows(factory.create(), fileData, expectedThrowable, true, false, false); - assertThrows(factory.create(), fileData, expectedThrowable, false, true, false); - assertThrows(factory.create(), fileData, expectedThrowable, true, true, false); - assertThrows(factory.create(), fileData, expectedThrowable, false, false, true); - assertThrows(factory.create(), fileData, expectedThrowable, true, false, true); - assertThrows(factory.create(), fileData, expectedThrowable, false, true, true); - assertThrows(factory.create(), fileData, expectedThrowable, true, true, true); - } - - /** - * Asserts {@code extractor} throws {@code expectedThrowable} while consuming {@code fileData}. - * - * @param extractor The {@link Extractor} to be tested. - * @param fileData Content of the input file. - * @param expectedThrowable Expected {@link Throwable} class. - * @param simulateIOErrors If true simulates IOErrors. - * @param simulateUnknownLength If true simulates unknown input length. - * @param simulatePartialReads If true simulates partial reads. - * @throws IOException If reading from the input fails. - */ - private static void assertThrows( - Extractor extractor, - byte[] fileData, - Class expectedThrowable, - boolean simulateIOErrors, - boolean simulateUnknownLength, - boolean simulatePartialReads) - throws IOException { - FakeExtractorInput input = new FakeExtractorInput.Builder().setData(fileData) - .setSimulateIOErrors(simulateIOErrors) - .setSimulateUnknownLength(simulateUnknownLength) - .setSimulatePartialReads(simulatePartialReads).build(); - try { - consumeTestData(extractor, input, 0, true); - throw new AssertionError(expectedThrowable.getSimpleName() + " expected but not thrown"); - } catch (Throwable throwable) { - if (expectedThrowable.equals(throwable.getClass())) { - return; // Pass! - } - throw throwable; - } - } - private ExtractorAsserts() {} private static FakeExtractorOutput consumeTestData(