@Test public void testChangeTimeMode() { when(timeInstantView.getTimeModeSelectedIndex()).thenReturn(TimeInstant.TimeMode.BEGIN.getIndex()); TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor); timeInstantEditor.init(null, changeCommand); timeInstantEditor.changeTimeMode(); TimeInstant timeInstant = timeInstantEditor.getTimeInstant(); assertEquals(timeInstant.getTimeMode(), TimeInstant.TimeMode.BEGIN); verify(changeCommand).execute(); }
void changeTimeMode() { int selectedIdx = view.getTimeModeSelectedIndex(); TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx); timeInstant.setTimeMode(mode); TimeAmount timeAmount = timeInstant.getTimeAmount(); if (timeAmount != null) { timeAmount.setQuantity(0); } onChangeCommand.execute(); initIntervalTypeSelector(); }
TimeInstantEditor implements IsWidget { void changeTimeMode() { int selectedIdx = view.getTimeModeSelectedIndex(); TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx); timeInstant.setTimeMode(mode); TimeAmount timeAmount = timeInstant.getTimeAmount(); if (timeAmount != null) { timeAmount.setQuantity(0); } onChangeCommand.execute(); initIntervalTypeSelector(); } }
TimeInstantEditor implements IsWidget { void changeTimeMode() { int selectedIdx = view.getTimeModeSelectedIndex(); TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx); timeInstant.setTimeMode(mode); TimeAmount timeAmount = timeInstant.getTimeAmount(); if (timeAmount != null) { timeAmount.setQuantity(0); } onChangeCommand.execute(); initIntervalTypeSelector(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); }
TimeInstantEditor implements IsWidget { void changeTimeMode() { int selectedIdx = view.getTimeModeSelectedIndex(); TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx); timeInstant.setTimeMode(mode); TimeAmount timeAmount = timeInstant.getTimeAmount(); if (timeAmount != null) { timeAmount.setQuantity(0); } onChangeCommand.execute(); initIntervalTypeSelector(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); @Override Widget asWidget(); TimeInstant getTimeInstant(); void init(final TimeInstant ti, final Command onChangeCommand); TimeAmountEditor getTimeAmountEditor(); }
TimeInstantEditor implements IsWidget { void changeTimeMode() { int selectedIdx = view.getTimeModeSelectedIndex(); TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx); timeInstant.setTimeMode(mode); TimeAmount timeAmount = timeInstant.getTimeAmount(); if (timeAmount != null) { timeAmount.setQuantity(0); } onChangeCommand.execute(); initIntervalTypeSelector(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); @Override Widget asWidget(); TimeInstant getTimeInstant(); void init(final TimeInstant ti, final Command onChangeCommand); TimeAmountEditor getTimeAmountEditor();  }