Color implements ConfigurationSerializable { public static Color fromRGB(int red, int green, int blue) throws IllegalArgumentException { return new Color(red, green, blue); } private  Color(int red, int green, int blue); static Color fromRGB(int red, int green, int blue); static Color fromBGR(int blue, int green, int red); static Color fromRGB(int rgb); static Color fromBGR(int bgr); int getRed(); Color setRed(int red); int getGreen(); Color setGreen(int green); int getBlue(); Color setBlue(int blue); int asRGB(); int asBGR(); Color mixDyes(DyeColor... colors); Color mixColors(Color... colors); @Override boolean equals(Object o); @Override int hashCode(); Map<String, Object> serialize(); @SuppressWarnings("javadoc") static Color deserialize(Map<String, Object> map); @Override String toString(); static final Color WHITE; static final Color SILVER; static final Color GRAY; static final Color BLACK; static final Color RED; static final Color MAROON; static final Color YELLOW; static final Color OLIVE; static final Color LIME; static final Color GREEN; static final Color AQUA; static final Color TEAL; static final Color BLUE; static final Color NAVY; static final Color FUCHSIA; static final Color PURPLE; static final Color ORANGE; }
@Test public void testSerialization() throws Throwable { for (TestColor testColor : examples) { Color base = Color.fromRGB(testColor.rgb); YamlConfiguration toSerialize = new YamlConfiguration(); toSerialize.set("color", base); String serialized = toSerialize.saveToString(); YamlConfiguration deserialized = new YamlConfiguration(); deserialized.loadFromString(serialized); assertThat(testColor.name + " on " + serialized, base, is(deserialized.getColor("color"))); } }
@Test(expected=IllegalArgumentException.class) public void testInvalidRGB1() { Color.fromRGB(0x01000000); }
@Test(expected=IllegalArgumentException.class) public void testInvalidRGB2() { Color.fromRGB(Integer.MIN_VALUE); }
@Test(expected=IllegalArgumentException.class) public void testInvalidRGB3() { Color.fromRGB(Integer.MAX_VALUE); }
@Test(expected=IllegalArgumentException.class) public void testInvalidRGB4() { Color.fromRGB(-1); }
@Test(expected=IllegalArgumentException.class) public void testInvalidR01() { Color.fromRGB(-1, 0x00, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidR02() { Color.fromRGB(Integer.MAX_VALUE, 0x00, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidR03() { Color.fromRGB(Integer.MIN_VALUE, 0x00, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidR04() { Color.fromRGB(0x100, 0x00, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidB01() { Color.fromRGB(0x00, 0x00, -1); }
@Test(expected=IllegalArgumentException.class) public void testInvalidB02() { Color.fromRGB(0x00, 0x00, Integer.MAX_VALUE); }
@Test(expected=IllegalArgumentException.class) public void testInvalidB03() { Color.fromRGB(0x00, 0x00, Integer.MIN_VALUE); }
@Test(expected=IllegalArgumentException.class) public void testInvalidB04() { Color.fromRGB(0x00, 0x00, 0x100); }
@Test(expected=IllegalArgumentException.class) public void testInvalidG01() { Color.fromRGB(0x00, -1, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidG02() { Color.fromRGB(0x00, Integer.MAX_VALUE, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidG03() { Color.fromRGB(0x00, Integer.MIN_VALUE, 0x00); }
@Test(expected=IllegalArgumentException.class) public void testInvalidG04() { Color.fromRGB(0x00, 0x100, 0x00); }