Topping { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Topping topping = (Topping) o; if (id != topping.id) return false; if (color != topping.color) return false; return previousColor == topping.previousColor; } Topping(int id); int getId(); int getColor(); int getPreviousColor(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final int PRIMARY; static final int PRIMARY_DARK; static final int ACCENT; }
@Test public void equals() throws Exception { Topping t1 = new Topping(MOCK_ID); t1.updateColor(MOCK_DEFAULT_COLOR); assertEquals(mToppingMock, t1); }