TimeInstantEditor implements IsWidget { void changeIntervalType() { int selectedIdx = view.getSelectedIntervalTypeIndex(); DateIntervalType intervalType = INTERVAL_TYPES.get(selectedIdx); timeInstant.setIntervalType(intervalType); onChangeCommand.execute(); initIntervalTypeSelector(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); @Override Widget asWidget(); TimeInstant getTimeInstant(); void init(final TimeInstant ti, final Command onChangeCommand); TimeAmountEditor getTimeAmountEditor();  }
@Test public void testChangeIntervalType() { when(timeInstantView.getSelectedIntervalTypeIndex()).thenReturn(0); TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor); timeInstantEditor.init(null, changeCommand); timeInstantEditor.changeIntervalType(); TimeInstant timeInstant = timeInstantEditor.getTimeInstant(); assertEquals(timeInstant.getIntervalType(), DateIntervalType.MINUTE); verify(changeCommand).execute(); }