Use Truth convenience methods for Exception-related assertions

PiperOrigin-RevId: 373180764
This commit is contained in:
aquilescanta 2021-05-11 18:23:55 +01:00 committed by Oliver Woodman
parent 2a2d6f667d
commit ad46b90918

View File

@ -40,10 +40,10 @@ public class PlaybackExceptionTest {
// TODO: Add test for backwards compatibility. // TODO: Add test for backwards compatibility.
private static void assertPlaybackExceptionsAreEqual(PlaybackException a, PlaybackException b) { private static void assertPlaybackExceptionsAreEqual(PlaybackException a, PlaybackException b) {
assertThat(a.getMessage()).isEqualTo(b.getMessage()); assertThat(a).hasMessageThat().isEqualTo(b.getMessage());
assertThat(a.errorCode).isEqualTo(b.errorCode); assertThat(a.errorCode).isEqualTo(b.errorCode);
assertThat(a.timestampMs).isEqualTo(b.timestampMs); assertThat(a.timestampMs).isEqualTo(b.timestampMs);
assertThat(a.getCause().getClass()).isSameInstanceAs(b.getCause().getClass()); assertThat(a.getCause().getClass()).isSameInstanceAs(b.getCause().getClass());
assertThat(a.getCause().getMessage()).isEqualTo(b.getCause().getMessage()); assertThat(a).hasCauseThat().hasMessageThat().isEqualTo(b.getCause().getMessage());
} }
} }