BaseSetter implements Setter { @Override public final void setColour(@ColorInt int colour) { if (colour != lastColour) { lastColour = colour; onSetColour(filter.filter(colour)); } } protected  BaseSetter(Filter filter); protected  BaseSetter(Filter filter, boolean transientChanges); @Override final void setColour(@ColorInt int colour); @Override final void setTransientColour(@ColorInt int colour); abstract void onSetColour(@ColorInt int colour);  }
@Test public void givenATransientColourSetterNonTransientEventsAreHandled() { TransientSetter colourSetter = new TransientSetter(identityFilter); colourSetter.setColour(ColourUtils.TEST_COLOUR); assertThat(colourSetter.onSetColourCalled).isTrue(); }
@Test public void givenANonTransientColourSetterNonTransientEventsAreHandled() { NonTransientSetter colourSetter = new NonTransientSetter(identityFilter); colourSetter.setColour(ColourUtils.TEST_COLOUR); assertThat(colourSetter.onSetColourCalled).isTrue(); }