Topping { void updateColor(@ColorInt int color){ this.previousColor = this.color; this.color = color; } 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; }
@SuppressWarnings("ResourceAsColor") @Test public void updateColor() throws Exception { int newColor = -123456; mToppingMock.updateColor(newColor); int color = mToppingMock.getColor(); int prevColor = mToppingMock.getPreviousColor(); assertThat(color, is(newColor)); assertThat(prevColor, is(MOCK_DEFAULT_COLOR)); }