GenericColor extends AbstractDatatype { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } GenericColor other = (GenericColor) obj; if (!Objects.equals(this.alpha, other.alpha)) { return false; } if (!Objects.equals(this.red, other.red)) { return false; } if (!Objects.equals(this.green, other.green)) { return false; } if (!Objects.equals(this.blue, other.blue)) { return false; } if (!Objects.equals(this.brightness, other.brightness)) { return false; } if (!Objects.equals(this.chroma, other.chroma)) { return false; } if (!Objects.equals(this.hue, other.hue)) { return false; } if (!Objects.equals(this.lightness, other.lightness)) { return false; } if (!Objects.equals(this.saturationHsb, other.saturationHsb)) { return false; } if (!Objects.equals(this.saturationHsl, other.saturationHsl)) { return false; } return true; } protected  GenericColor(); static GenericColor valueOf(String color); static GenericColor valueOf(Color color); static GenericColor valueOf(Red red, Green green, Blue blue, Alpha alpha); static GenericColor valueOf(Hue hue, Saturation saturation, Brightness brightness, Alpha alpha); static GenericColor valueOf(Hue hue, Saturation saturation, Lightness lightness, Alpha alpha); Alpha getAlpha(); Hue getHue(); Saturation getSaturationHsb(); Saturation getSaturationHsl(); Brightness getBrightness(); Lightness getLightness(); Chroma getChroma(); Red getRed(); Blue getBlue(); Green getGreen(); AbstractDoubleSegment<?> getSegment(ColorSegmentType type); Color toColor(); GenericColor invert(ColorModel model); GenericColor lighten(ColorFactor factor); GenericColor darken(ColorFactor factor); @Override String toString(); String toString(ColorModel colorModel); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { GenericColor color = GenericColor.valueOf(Color.NAVY); assertThat(color).isEqualTo(color).isNotEqualTo(null).isNotEqualTo("navy"); Red red = color.getRed(); Green green = color.getGreen(); Blue blue = color.getBlue(); Alpha alpha = new Alpha(0.5); assertThat(color).isNotEqualTo(GenericColor.valueOf(red, green, blue, alpha)); assertThat(color).isNotEqualTo(GenericColor.valueOf(red, green, new Blue(1.0), color.getAlpha())); assertThat(color).isNotEqualTo(GenericColor.valueOf(red, new Green(1.0), blue, color.getAlpha())); assertThat(color).isNotEqualTo(GenericColor.valueOf(new Red(1.0), green, blue, color.getAlpha())); }