Add @ForOverride annotation to DataSourceContractTest

PiperOrigin-RevId: 687223500
(cherry picked from commit 3ba2fa6c076ee59629fcda6f35875bffd0fc0135)
This commit is contained in:
ibaker 2024-10-18 02:27:04 -07:00 committed by Iván Budnik
parent 332aa7d34b
commit 9c15ea5436

View File

@ -44,6 +44,7 @@ import androidx.media3.datasource.TransferListener;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.ForOverride;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -80,6 +81,7 @@ public abstract class DataSourceContractTest {
* <p>Only one of {@link #createDataSource()} and {@link #createDataSources()} should be * <p>Only one of {@link #createDataSource()} and {@link #createDataSources()} should be
* implemented. * implemented.
*/ */
@ForOverride
protected DataSource createDataSource() throws Exception { protected DataSource createDataSource() throws Exception {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -90,6 +92,7 @@ public abstract class DataSourceContractTest {
* <p>Only one of {@link #createDataSource()} and {@link #createDataSources()} should be * <p>Only one of {@link #createDataSource()} and {@link #createDataSources()} should be
* implemented. * implemented.
*/ */
@ForOverride
protected List<DataSource> createDataSources() throws Exception { protected List<DataSource> createDataSources() throws Exception {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -100,6 +103,7 @@ public abstract class DataSourceContractTest {
* same {@link DataSource} then {@code null} can be returned. * same {@link DataSource} then {@code null} can be returned.
*/ */
@Nullable @Nullable
@ForOverride
protected DataSource getTransferListenerDataSource() { protected DataSource getTransferListenerDataSource() {
return null; return null;
} }
@ -108,6 +112,7 @@ public abstract class DataSourceContractTest {
* Returns whether the {@link DataSource} will continue reading indefinitely for unbounded {@link * Returns whether the {@link DataSource} will continue reading indefinitely for unbounded {@link
* DataSpec DataSpecs}. * DataSpec DataSpecs}.
*/ */
@ForOverride
protected boolean unboundedReadsAreIndefinite() { protected boolean unboundedReadsAreIndefinite() {
return false; return false;
} }
@ -121,6 +126,7 @@ public abstract class DataSourceContractTest {
* <p>If multiple resources are returned, it's recommended to disambiguate them using {@link * <p>If multiple resources are returned, it's recommended to disambiguate them using {@link
* TestResource.Builder#setName(String)}. * TestResource.Builder#setName(String)}.
*/ */
@ForOverride
protected abstract ImmutableList<TestResource> getTestResources() throws Exception; protected abstract ImmutableList<TestResource> getTestResources() throws Exception;
/** /**
@ -128,6 +134,7 @@ public abstract class DataSourceContractTest {
* *
* <p>This is used to test how a {@link DataSource} handles nonexistent data. * <p>This is used to test how a {@link DataSource} handles nonexistent data.
*/ */
@ForOverride
protected abstract Uri getNotFoundUri(); protected abstract Uri getNotFoundUri();
@Test @Test