use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KSessionSelectorTest method onSelectionChange.
@Test
public void onSelectionChange() {
Command command = mock(Command.class);
selector.setSelectionChangeHandler(command);
selector.onSelectionChange();
verify(command, times(1)).execute();
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddCommonActions.
@Test
public void testAddCommonActions() {
final Command onValidate = mock(Command.class);
final MenuItem buildMenu = mock(MenuItem.class);
final MenuItem build = mock(MenuItem.class);
doReturn(onValidate).when(presenter).onValidate();
doReturn(buildMenu).when(versionRecordManager).buildMenu();
doReturn(build).when(alertsButtonMenuItemBuilder).build();
presenter.addCommonActions(fileMenuBuilder);
verify(fileMenuBuilder).addValidate(onValidate);
verify(fileMenuBuilder).addNewTopLevelMenu(buildMenu);
verify(fileMenuBuilder).addNewTopLevelMenu(build);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testSave.
@Test
public void testSave() {
doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject();
doReturn(true).when(projectController).canUpdateProject(any());
final TestDocument document = createTestDocument();
registerDocument(document);
activateDocument(document);
editor.getSaveMenuItem();
final ArgumentCaptor<Command> saveCommandCaptor = ArgumentCaptor.forClass(Command.class);
verify(versionRecordManager, times(1)).newSaveMenuItem(saveCommandCaptor.capture());
final Command saveCommand = saveCommandCaptor.getValue();
assertNotNull(saveCommand);
saveCommand.execute();
verify(editorView, times(1)).showSaving();
verify(editor, times(1)).doSave(eq(document));
verify(editor, times(1)).doSaveCheckForAndHandleConcurrentUpdate(eq(document));
verify(editor, times(1)).onSave(eq(document), eq("commit"));
verify(document, times(1)).setConcurrentUpdateSessionInfo(eq(null));
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testRenameCommand.
@Test
public void testRenameCommand() {
final TestDocument document = createTestDocument();
final ObservablePath path = document.getLatestPath();
registerDocument(document);
final ArgumentCaptor<Command> renameCommandCaptor = ArgumentCaptor.forClass(Command.class);
verify(path, times(1)).onRename(renameCommandCaptor.capture());
final Command renameCommand = renameCommandCaptor.getValue();
assertNotNull(renameCommand);
renameCommand.execute();
verify(editorView, times(2)).refreshTitle(any(String.class));
verify(editorView, times(1)).showBusyIndicator(any(String.class));
verify(editor, times(2)).getDocumentTitle(eq(document));
verify(editor, times(1)).refreshDocument(eq(document));
verify(changeTitleEvent, times(1)).fire(any(ChangeTitleWidgetEvent.class));
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method testRegisterDocument.
@Test
public void testRegisterDocument() {
final KieDocument document = makeKieDocument();
builder.registerDocument(document);
verify(documentMenuItem, times(1)).setName("filename");
verify(documentMenuItem, times(1)).setRemoveDocumentCommand(removeDocumentCommandCaptor.capture());
verify(documentMenuItem, times(1)).setActivateDocumentCommand(activateDocumentCommandCaptor.capture());
verify(view, times(1)).addDocument(eq(documentMenuItem));
final Command removeDocumentCommand = removeDocumentCommandCaptor.getValue();
assertNotNull(removeDocumentCommand);
removeDocumentCommand.execute();
verify(builder, times(1)).onRemoveDocument(document);
final Command activateDocumentCommand = activateDocumentCommandCaptor.getValue();
assertNotNull(activateDocumentCommand);
activateDocumentCommand.execute();
verify(builder, times(1)).onActivateDocument(document);
}
Aggregations