Avoid type-ambiguous overloads in ExoPlaybackExceptionTest

PiperOrigin-RevId: 372942778
This commit is contained in:
aquilescanta 2021-05-10 17:15:26 +01:00 committed by Oliver Woodman
parent 5167ca65fb
commit 763ef2b911

View File

@ -31,7 +31,7 @@ public class ExoPlaybackExceptionTest {
public void roundTripViaBundle_ofExoPlaybackExceptionTypeRemote_yieldsEqualInstance() { public void roundTripViaBundle_ofExoPlaybackExceptionTypeRemote_yieldsEqualInstance() {
ExoPlaybackException before = ExoPlaybackException.createForRemote(/* message= */ "test"); ExoPlaybackException before = ExoPlaybackException.createForRemote(/* message= */ "test");
ExoPlaybackException after = ExoPlaybackException.CREATOR.fromBundle(before.toBundle()); ExoPlaybackException after = ExoPlaybackException.CREATOR.fromBundle(before.toBundle());
assertThat(areEqual(before, after)).isTrue(); assertThat(areExoPlaybackExceptionsEqual(before, after)).isTrue();
} }
@Test @Test
@ -46,7 +46,7 @@ public class ExoPlaybackExceptionTest {
/* isRecoverable= */ true); /* isRecoverable= */ true);
ExoPlaybackException after = ExoPlaybackException.CREATOR.fromBundle(before.toBundle()); ExoPlaybackException after = ExoPlaybackException.CREATOR.fromBundle(before.toBundle());
assertThat(areEqual(before, after)).isTrue(); assertThat(areExoPlaybackExceptionsEqual(before, after)).isTrue();
} }
@Test @Test
@ -61,7 +61,8 @@ public class ExoPlaybackExceptionTest {
assertThat(after.getCause()).hasMessageThat().isEqualTo(before.getCause().getMessage()); assertThat(after.getCause()).hasMessageThat().isEqualTo(before.getCause().getMessage());
} }
private static boolean areEqual(ExoPlaybackException a, ExoPlaybackException b) { private static boolean areExoPlaybackExceptionsEqual(
ExoPlaybackException a, ExoPlaybackException b) {
if (a == null || b == null) { if (a == null || b == null) {
return a == b; return a == b;
} }
@ -73,10 +74,10 @@ public class ExoPlaybackExceptionTest {
&& a.rendererFormatSupport == b.rendererFormatSupport && a.rendererFormatSupport == b.rendererFormatSupport
&& a.timestampMs == b.timestampMs && a.timestampMs == b.timestampMs
&& a.isRecoverable == b.isRecoverable && a.isRecoverable == b.isRecoverable
&& areEqual(a.getCause(), b.getCause()); && areThrowablesEqual(a.getCause(), b.getCause());
} }
private static boolean areEqual(Throwable a, Throwable b) { private static boolean areThrowablesEqual(Throwable a, Throwable b) {
if (a == null || b == null) { if (a == null || b == null) {
return a == b; return a == b;
} }