use of org.pentaho.ui.xul.impl.AbstractXulLoader in project pdi-dataservice-server-plugin by pentaho.
the class DriverDetailsDialogTest method testInitXul.
@Test
public void testInitXul() throws Exception {
DriverDetailsDialog dialog = mock(DriverDetailsDialog.class);
Shell parentShell = mock(Shell.class);
AbstractXulLoader xulLoader = mock(AbstractXulLoader.class);
XulRunner xulRunner = mock(XulRunner.class);
Document document = mock(Document.class);
XulDomContainer container = mock(XulDomContainer.class);
doReturn(container).when(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
doReturn(document).when(container).getDocumentRoot();
doCallRealMethod().when(dialog).initXul(parentShell, xulLoader, xulRunner);
assertThat(document, is(sameInstance(dialog.initXul(parentShell, xulLoader, xulRunner))));
verify(xulLoader).setOuterContext(parentShell);
verify(xulLoader).registerClassLoader(dialog.getClass().getClassLoader());
verify(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
verify(container).addEventHandler(any(DriverDetailsDialogController.class));
verify(container).getDocumentRoot();
verify(xulRunner).addContainer(container);
verify(xulRunner).initialize();
}
use of org.pentaho.ui.xul.impl.AbstractXulLoader in project pdi-dataservice-server-plugin by pentaho.
the class DriverDetailsDialogTest method testInitXulThrowsKettleExceptionOnError.
@Test(expected = KettleException.class)
public void testInitXulThrowsKettleExceptionOnError() throws KettleException {
DriverDetailsDialog dialog = mock(DriverDetailsDialog.class);
AbstractXulLoader xulLoader = mock(AbstractXulLoader.class);
doCallRealMethod().when(dialog).initXul(null, xulLoader, null);
doThrow(XulException.class).when(xulLoader).setOuterContext(null);
dialog.initXul(null, xulLoader, null);
}
Aggregations