TimeAmountEditor implements IsWidget { public void increaseQuantity() { long q = getQuantity()+1; changeQuantity(q); view.setQuantity(q); } @Inject  TimeAmountEditor(View view); @Override Widget asWidget(); TimeAmount getTimeAmount(); void init(final TimeAmount ta, Command onChangeCommand); long getQuantity(); void decreaseQuantity(); void increaseQuantity(); void changeQuantity(String value); void changeIntervalType(); static List<DateIntervalType> INTERVAL_TYPES; }
@Test public void testIncreaseQuantity() { TimeAmount timeAmount = new TimeAmount(10, DateIntervalType.DAY); TimeAmountEditor timeAmountEditor = new TimeAmountEditor(timeAmountView); timeAmountEditor.init(timeAmount, changeCommand); timeAmountEditor.increaseQuantity(); verify(timeAmountView).setQuantity(11); verify(changeCommand).execute(); assertEquals(timeAmount.getQuantity(), 11); }