mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Migrate from strongly discouraged @Test(expected = ...) to assertThrows(...).
More info: go/lsc-assertthrows and go/assertthrows
NOTE: if the source of truth for this code is _NOT_ `//third_party/`, please ask for this CL to be reverted.
Tested:
TAP --sample ran all affected tests and none failed
http://test/OCL:434925976:BASE:434869111:1647399186064:de338189
PiperOrigin-RevId: 435047509
This commit is contained in:
parent
191629ed7c
commit
845b55d230
1 changed files with 11 additions and 8 deletions
|
|
@ -22,6 +22,7 @@ import static android.graphics.Color.argb;
|
||||||
import static android.graphics.Color.parseColor;
|
import static android.graphics.Color.parseColor;
|
||||||
import static androidx.media3.common.util.ColorParser.parseTtmlColor;
|
import static androidx.media3.common.util.ColorParser.parseTtmlColor;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
@ -34,24 +35,26 @@ public final class ColorParserTest {
|
||||||
|
|
||||||
// Negative tests.
|
// Negative tests.
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void parseUnknownColor() {
|
public void parseUnknownColor() {
|
||||||
ColorParser.parseTtmlColor("colorOfAnElectron");
|
assertThrows(
|
||||||
|
IllegalArgumentException.class, () -> ColorParser.parseTtmlColor("colorOfAnElectron"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void parseNull() {
|
public void parseNull() {
|
||||||
ColorParser.parseTtmlColor(null);
|
assertThrows(IllegalArgumentException.class, () -> ColorParser.parseTtmlColor(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void parseEmpty() {
|
public void parseEmpty() {
|
||||||
ColorParser.parseTtmlColor("");
|
assertThrows(IllegalArgumentException.class, () -> ColorParser.parseTtmlColor(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void rgbColorParsingRgbValuesNegative() {
|
public void rgbColorParsingRgbValuesNegative() {
|
||||||
ColorParser.parseTtmlColor("rgb(-4, 55, 209)");
|
assertThrows(
|
||||||
|
IllegalArgumentException.class, () -> ColorParser.parseTtmlColor("rgb(-4, 55, 209)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positive tests.
|
// Positive tests.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue