use of org.uberfire.client.callbacks.Callback in project kie-wb-common by kiegroup.
the class PipelineParamsPagePresenterTest method testIsComplete.
@Test
public void testIsComplete() {
presenter.setPipelineParamsForm(paramsForm);
Callback callback = mock(Callback.class);
presenter.isComplete(callback);
verify(paramsForm, times(1)).isComplete(callback);
}
use of org.uberfire.client.callbacks.Callback in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testOpenDocumentInEditor_OneDocumentNotAlreadyRegistered.
@Test
@SuppressWarnings("unchecked")
public void testOpenDocumentInEditor_OneDocumentNotAlreadyRegistered() {
// Mock two documents being available, one is already registered; the other is not.
final TestDocument document = createTestDocument();
final ObservablePath currentPath = document.getCurrentPath();
registerDocument(document);
final Path newDocumentPath = mock(Path.class);
doAnswer((invocation) -> {
final Callback<List<Path>> callback = (Callback) invocation.getArguments()[0];
callback.callback(new ArrayList<Path>() {
{
add(currentPath);
add(newDocumentPath);
}
});
return null;
}).when(editor).getAvailableDocumentPaths(any(Callback.class));
editor.openDocumentInEditor();
final ArgumentCaptor<List> pathsArgumentCaptor = ArgumentCaptor.forClass(List.class);
verify(kieEditorWrapperView, times(1)).showAdditionalDocuments(pathsArgumentCaptor.capture());
final List<Path> paths = pathsArgumentCaptor.getValue();
assertNotNull(paths);
assertEquals(1, paths.size());
assertEquals(newDocumentPath, paths.get(0));
}
use of org.uberfire.client.callbacks.Callback in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testOpenDocumentInEditor_OneDocumentAlreadyRegistered.
@Test
@SuppressWarnings("unchecked")
public void testOpenDocumentInEditor_OneDocumentAlreadyRegistered() {
// Mock one document being available, but it's the same as already registered.
final TestDocument document = createTestDocument();
final ObservablePath currentPath = document.getCurrentPath();
registerDocument(document);
doAnswer((invocation) -> {
final Callback<List<Path>> callback = (Callback) invocation.getArguments()[0];
callback.callback(new ArrayList<Path>() {
{
add(currentPath);
}
});
return null;
}).when(editor).getAvailableDocumentPaths(any(Callback.class));
editor.openDocumentInEditor();
verify(kieEditorWrapperView, times(1)).showNoAdditionalDocuments();
verify(kieEditorWrapperView, never()).showAdditionalDocuments(any(List.class));
}
use of org.uberfire.client.callbacks.Callback in project kie-wb-common by kiegroup.
the class ExternalLinkPresenterTest method edit.
@Test
public void edit() throws Exception {
final Callback callback = mock(Callback.class);
presenter.addChangeCallback(callback);
presenter.onTextChange("hello");
verify(callback).callback("hello");
}
use of org.uberfire.client.callbacks.Callback in project drools-wb by kiegroup.
the class BaseEnumSingleSelectUiColumnTest method setupEnums.
@SuppressWarnings("unchecked")
private void setupEnums(final String cellValue, final String... values) {
final Map<String, String> enums = new HashMap<>();
for (String value : values) {
enums.put(value, value);
}
doAnswer((InvocationOnMock invocation) -> {
final Callback<Map<String, String>> callback = (Callback<Map<String, String>>) invocation.getArguments()[3];
callback.callback(enums);
return null;
}).when(presenter).getEnumLookups(anyString(), anyString(), any(DependentEnumsUtilities.Context.class), any(Callback.class));
when(multiValueFactory.convert(eq(cellValue))).thenReturn(cellValue);
}
Aggregations