From 7f79db072437fe8a221b53c05a7431996090f769 Mon Sep 17 00:00:00 2001 From: Adam Richter Date: Wed, 15 May 2019 13:44:26 -0700 Subject: [PATCH] Split a few assertThat(a && b).isTrue() calls into separate assertions for more precise diagnostics. --- .../com/google/android/exoplayer2/source/ShuffleOrderTest.java | 3 ++- .../android/exoplayer2/upstream/DataSourceInputStreamTest.java | 3 ++- .../google/android/exoplayer2/testutil/FakeExtractorInput.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/library/core/src/test/java/com/google/android/exoplayer2/source/ShuffleOrderTest.java b/library/core/src/test/java/com/google/android/exoplayer2/source/ShuffleOrderTest.java index 8fce472c68..17b0996387 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/source/ShuffleOrderTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/source/ShuffleOrderTest.java @@ -123,7 +123,8 @@ public final class ShuffleOrderTest { assertThat(shuffleOrder.getLastIndex()).isEqualTo(indices[length - 1]); assertThat(shuffleOrder.getNextIndex(indices[length - 1])).isEqualTo(INDEX_UNSET); for (int i = 0; i < length; i++) { - assertThat(indices[i] >= 0 && indices[i] < length).isTrue(); + assertThat(indices[i] >= 0).isTrue(); + assertThat(indices[i] < length).isTrue(); } } } diff --git a/library/core/src/test/java/com/google/android/exoplayer2/upstream/DataSourceInputStreamTest.java b/library/core/src/test/java/com/google/android/exoplayer2/upstream/DataSourceInputStreamTest.java index 257f1c45b3..e9823697f7 100644 --- a/library/core/src/test/java/com/google/android/exoplayer2/upstream/DataSourceInputStreamTest.java +++ b/library/core/src/test/java/com/google/android/exoplayer2/upstream/DataSourceInputStreamTest.java @@ -40,7 +40,8 @@ public final class DataSourceInputStreamTest { // Read bytes. for (int i = 0; i < TEST_DATA.length; i++) { int readByte = inputStream.read(); - assertThat(0 <= readByte && readByte < 256).isTrue(); + assertThat(0 <= readByte).isTrue(); + assertThat(readByte < 256).isTrue(); assertThat(readByte).isEqualTo(TEST_DATA[i] & 0xFF); assertThat(inputStream.bytesRead()).isEqualTo(i + 1); } diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorInput.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorInput.java index c467bd36af..20f6f436b0 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorInput.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorInput.java @@ -86,7 +86,8 @@ public final class FakeExtractorInput implements ExtractorInput { * @param position The position to set. */ public void setPosition(int position) { - assertThat(0 <= position && position <= data.length).isTrue(); + assertThat(0 <= position).isTrue(); + assertThat(position <= data.length).isTrue(); readPosition = position; peekPosition = position; }