@Test public void canMoveToNextEditorInPluralFormOnFirstRow() { // Given: current editor index is last index (represent last entry from move to previous) when(display.getEditors()).thenReturn(Lists.newArrayList(editor, editor2)); presenter.setStatesForTesting(selectedTU.getId(), TargetContentsPresenter.LAST_INDEX, display); // When: presenter.moveToNextEntry(); // Then: verify(display).focusEditor(1); verifyZeroInteractions(eventBus); }
@Test public void canMoveToNextEditorInPluralForm() { // Given: current editor index is 0 when(display.getEditors()).thenReturn(Lists.newArrayList(editor, editor2)); presenter.setStatesForTesting(selectedTU.getId(), 0, display); // When: presenter.moveToNextEntry(); // Then: verify(display).focusEditor(1); verifyZeroInteractions(eventBus); }
@Test public void canMoveToNextEntry() { // Given: current editor index is 1 TargetContentsPresenter spyPresenter = spy(presenter); spyPresenter.setStatesForTesting(selectedTU.getId(), 1, display); doNothing().when(spyPresenter).savePendingChangesIfApplicable(); // When: spyPresenter.moveToNextEntry(); // Then: verify(spyPresenter).savePendingChangesIfApplicable(); verify(eventBus).fireEvent(NavTransUnitEvent.NEXT_ENTRY_EVENT); }