WebColors extends HashMap<String, int[]> { public static DeviceRgb getRGBColor(String name) { float[] rgbaColor = getRGBAColor(name); if (rgbaColor == null) { return new DeviceRgb(0, 0, 0); } else { return new DeviceRgb(rgbaColor[0], rgbaColor[1], rgbaColor[2]); } }  static DeviceRgb getRGBColor(String name); static float[] getRGBAColor(String name); static final WebColors NAMES; }
@Test public void getRGBColorBySupportedNameTest() { String colorName = "violet"; DeviceRgb cmpRgb = new DeviceRgb(0xee, 0x82, 0xee); DeviceRgb resultRgb = WebColors.getRGBColor(colorName); Assert.assertEquals(cmpRgb, resultRgb); }
@Test public void getRGBColorByUnsupportedNameTest() { String colorName = "tangerine"; DeviceRgb cmpRgb = new DeviceRgb(0,0,0); DeviceRgb resultRgb = WebColors.getRGBColor(colorName); Assert.assertEquals(cmpRgb, resultRgb); }