### Question:
KieEditor extends BaseEditor<T, Metadata> implements KieEditorWrapperView.KieEditorWrapperPresenter { protected void addRename(final FileMenuBuilder fileMenuBuilder) { final Optional<? extends Caller<? extends SupportsSaveAndRename<T, Metadata>>> saveAndRenameServiceCaller = Optional.ofNullable(getSaveAndRenameServiceCaller()); if (saveAndRenameServiceCaller.isPresent()) { fileMenuBuilder.addRename(getSaveAndRename()); } else { fileMenuBuilder.addRename(versionRecordManager.getPathToLatest(), assetUpdateValidator); } } protected  KieEditor(); protected  KieEditor(final KieEditorView baseView); void onShowDiagramEditorDocks(@Observes PlaceGainFocusEvent event); void onHideDocks(@Observes PlaceHiddenEvent event); void showDocks(); void hideDocks(); boolean verifyEventIdentifier(AbstractPlaceEvent event); @Override void setOriginalHash(Integer originalHash); boolean mayClose(Object object); @OnClose void onClose(); void addDownloadMenuItem(final FileMenuBuilder fileMenuBuilder); @Override Validator getRenameValidator(); void setSelectedTab(int index); IsWidget getWidget(); void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event); @Override boolean mayClose(Integer currentHash); @Override void onOverviewSelected(); @Override void onSourceTabSelected(); @Override void onEditTabSelected(); @Override void onEditTabUnselected(); void addTabBarWidget(final IsWidget customWidget);  }### Answer:
@Test public void testAddRenameWhenSaveAndRenameIsEnabled() { final Caller saveAndRenameCaller = mock(Caller.class); final Command command = mock(Command.class); doReturn(saveAndRenameCaller).when(presenter).getSaveAndRenameServiceCaller(); doReturn(command).when(presenter).getSaveAndRename(); presenter.addRename(fileMenuBuilder); verify(fileMenuBuilder).addRename(command); }
@Test public void testAddRenameWhenSaveAndRenameIsNotEnabled() { final ObservablePath observablePath = mock(ObservablePath.class); doReturn(observablePath).when(versionRecordManager).getPathToLatest(); doReturn(null).when(presenter).getSaveAndRenameServiceCaller(); presenter.addRename(fileMenuBuilder); verify(fileMenuBuilder).addRename(observablePath, assetUpdateValidator); }