use of org.pentaho.di.trans.dataservice.ui.controller.DataServiceRemapConfirmationDialogController in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapConfirmationDialogTest method testGetAction.
@Test
public void testGetAction() {
DataServiceRemapConfirmationDialogController controller = mock(DataServiceRemapConfirmationDialogController.class);
when(controller.getAction()).thenReturn(REMAP);
DataServiceRemapConfirmationDialog dialog = new DataServiceRemapConfirmationDialog(mock(Shell.class), controller);
Assert.assertEquals(REMAP, dialog.getAction());
verify(controller).getAction();
}
use of org.pentaho.di.trans.dataservice.ui.controller.DataServiceRemapConfirmationDialogController in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapConfirmationDialogTest method testOpen.
@Test
public void testOpen() throws XulException, KettleException {
Shell shell = mock(Shell.class);
final Document document = mock(Document.class);
SwtDialog swtDialog = mock(SwtDialog.class);
when(document.getElementById(DataServiceRemapConfirmationDialog.XUL_DIALOG_ID)).thenReturn(swtDialog);
DataServiceRemapConfirmationDialogController controller = mock(DataServiceRemapConfirmationDialogController.class);
DataServiceRemapConfirmationDialog dialog = spy(new DataServiceRemapConfirmationDialog(shell, controller));
doAnswer(new Answer() {
private int invocations = 0;
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
if (invocations == 0) {
invocations++;
return document;
} else {
throw new XulException("");
}
}
}).when(dialog).initXul(same(shell), any(XulLoader.class), any(XulRunner.class));
dialog.open();
verify(dialog).initXul(same(shell), any(XulLoader.class), any(XulRunner.class));
verify(swtDialog).show();
try {
dialog.open();
} catch (Exception e) {
Assert.assertTrue(e instanceof KettleException);
}
}
Aggregations