ColorUtility { public static String toHex(Color color) { return String.format("#%06X", (0xFFFFFF & color.getRGB())); }  static String toHex(Color color); static String toHexLowercase(Color color); static Color fromHex(String hex);  }
@Test public void testToHex() { Color color = Color.RED; String expResult = "#FF0000"; String result = ColorUtility.toHex(color); assertThat(expResult, is(equalTo(result))); }