ColorParser { public static int parseTtmlColor(String colorExpression) { return parseColorInternal(colorExpression, false); } private  ColorParser(); static int parseTtmlColor(String colorExpression); static int parseCssColor(String colorExpression);  }
@Test(expected = IllegalArgumentException.class) public void testParseUnknownColor() { ColorParser.parseTtmlColor("colorOfAnElectron"); }
@Test(expected = IllegalArgumentException.class) public void testParseNull() { ColorParser.parseTtmlColor(null); }
@Test(expected = IllegalArgumentException.class) public void testParseEmpty() { ColorParser.parseTtmlColor(""); }
@Test(expected = IllegalArgumentException.class) public void testRgbColorParsingRgbValuesNegative() { ColorParser.parseTtmlColor("rgb(-4, 55, 209)"); }
@Test public void testHexCodeParsing() { assertThat(parseTtmlColor("#FFFFFF")).isEqualTo(WHITE); assertThat(parseTtmlColor("#FFFFFFFF")).isEqualTo(WHITE); assertThat(parseTtmlColor("#123456")).isEqualTo(parseColor("#FF123456")); assertThat(parseTtmlColor("#FFFFFF00")).isEqualTo(parseColor("#00FFFFFF")); assertThat(parseTtmlColor("#12345678")).isEqualTo(parseColor("#78123456")); }
@Test public void testRgbColorParsing() { assertThat(parseTtmlColor("rgb(255,255,255)")).isEqualTo(WHITE); assertThat(parseTtmlColor(" rgb ( 255, 255, 255)")).isEqualTo(WHITE); }