BackgroundColor { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof BackgroundColor) { BackgroundColor otherColor = (BackgroundColor) obj; if (otherColor.value() == this.value()) { return true; } } return false; } BackgroundColor(@ColorInt int color);  BackgroundColor(@Nullable @ColorInt Integer color, @ColorInt int fallbackColor); int value(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { BackgroundColor color = new BackgroundColor(Color.RED); assertFalse(color.equals(null)); assertFalse(color.equals(Color.RED)); assertFalse(color.equals(new BackgroundColor(Color.BLACK))); assertTrue(color.equals(new BackgroundColor(Color.RED))); assertTrue(color.equals(color)); }