use of org.pentaho.di.trans.dataservice.serialization.UndefinedDataServiceException in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceDialogControllerTest method testError.
@Test
public void testError() throws Exception {
UndefinedDataServiceException undefinedException = new UndefinedDataServiceException(dataServiceMeta);
doThrow(undefinedException).doReturn(dataServiceMeta).when(delegate).checkDefined(dataServiceMeta);
DataServiceAlreadyExistsException alreadyExistsException = new DataServiceAlreadyExistsException(dataServiceMeta);
doThrow(alreadyExistsException).doReturn(dataServiceMeta).when(delegate).checkConflict(dataServiceMeta, null);
MetaStoreException metaStoreException = new MetaStoreException();
doThrow(metaStoreException).doNothing().when(delegate).save(dataServiceMeta);
controller.saveAndClose();
verify(messageBox).setMessage(undefinedException.getMessage());
controller.saveAndClose();
verify(messageBox).setMessage(alreadyExistsException.getMessage());
verify(delegate, never()).save(any(DataServiceMeta.class));
controller.saveAndClose();
verify(messageBox, times(3)).open();
verify(logChannel).logError(anyString(), same(metaStoreException));
verify(dialog, never()).dispose();
controller.saveAndClose();
verify(dialog).dispose();
verifyNoMoreInteractions(logChannel);
}
Aggregations