Commit 8eb2354e by ibaker Committed by Oliver Woodman

Replace deprecated JUnit Assertions with Truth

PiperOrigin-RevId: 321168125
parent 437d1b6e
...@@ -21,7 +21,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; ...@@ -21,7 +21,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import java.util.Arrays; import java.util.Arrays;
import junit.framework.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -76,20 +75,19 @@ public final class ProjectionDecoderTest { ...@@ -76,20 +75,19 @@ public final class ProjectionDecoderTest {
assertThat(subMesh.textureCoords.length).isEqualTo(VERTEX_COUNT * 2); assertThat(subMesh.textureCoords.length).isEqualTo(VERTEX_COUNT * 2);
// Test first vertex // Test first vertex
testCoordinate(FIRST_VERTEX, vertices, 0, 3); testCoordinate(FIRST_VERTEX, vertices, /* offset= */ 0);
// Test last vertex // Test last vertex
testCoordinate(LAST_VERTEX, vertices, VERTEX_COUNT * 3 - 3, 3); testCoordinate(LAST_VERTEX, vertices, /* offset= */ VERTEX_COUNT * 3 - 3);
// Test first uv // Test first uv
testCoordinate(FIRST_UV, uv, 0, 2); testCoordinate(FIRST_UV, uv, /* offset= */ 0);
// Test last uv // Test last uv
testCoordinate(LAST_UV, uv, VERTEX_COUNT * 2 - 2, 2); testCoordinate(LAST_UV, uv, /* offset= */ VERTEX_COUNT * 2 - 2);
} }
/** Tests that the output coordinates match the expected. */ /** Tests that the output coordinates match the expected. */
private static void testCoordinate(float[] expected, float[] output, int offset, int count) { private static void testCoordinate(float[] expected, float[] output, int offset) {
for (int i = 0; i < count; i++) { float[] adjustedOutput = Arrays.copyOfRange(output, offset, offset + expected.length);
Assert.assertEquals(expected[i], output[i + offset]); assertThat(adjustedOutput).isEqualTo(expected);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment