DataServiceDelegate extends DataServiceFactory { private void showSavePrompt( String title, String message ) { MessageDialog dialog = getUiFactory().getMessageDialog( getShell(), title, null, message, MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "DataServiceDelegate.Yes.Button" ), BaseMessages.getString( PKG, "DataServiceDelegate.No.Button" ) }, 0 ); if ( dialog.open() == 0 ) { try { getSpoon().saveToFile( getSpoon().getActiveTransformation() ); } catch ( KettleException e ) { getLogChannel().logError( "Failed to save transformation", e ); } } else { showError( title, BaseMessages.getString( PKG, "DataServiceDelegate.PleaseSave.Message" ) ); } } DataServiceDelegate( DataServiceContext context );  DataServiceDelegate( DataServiceContext context, Spoon spoon );  DataServiceDelegate( DataServiceContext context, Supplier<Spoon> spoonSupplier ); static DataServiceDelegate withDefaultSpoonInstance( DataServiceContext context ); void createNewDataService( String stepName ); void editDataService( DataServiceMeta dataService ); void suggestEdit( DataServiceMeta dataServiceMeta, String title, String text ); SynchronizationListener createSyncService(); void showError( String title, String text ); boolean showPrompt( String title, String text ); @Override void save( DataServiceMeta dataService ); void removeDataService( DataServiceMeta dataService, boolean prompt ); @Override void removeDataService( DataServiceMeta dataService ); void showTestDataServiceDialog( DataServiceMeta dataService ); void showTestDataServiceDialog( DataServiceMeta dataService, Shell shell ); @Override Repository getRepository(); void showDriverDetailsDialog(); void showDriverDetailsDialog( Shell shell ); DataServiceRemapConfirmationDialog.Action showRemapConfirmationDialog( DataServiceMeta dataService,
      List<String> remainingStepNames ); DataServiceRemapStepChooserDialog.Action showRemapStepChooserDialog( DataServiceMeta dataService,
      List<String> remainingStepNames, TransMeta trans ); void showRemapNoStepsDialog( Shell shell ); Spoon getSpoon(); Shell getShell(); Display getDisplay(); void syncExec( Runnable runnable );  }
@Test public void testShowSavePrompt() throws Exception { transMeta.setChanged(); when( messageDialog.open() ).thenReturn( 0 ); when( spoon.saveToFile( transMeta ) ).then( new Answer<Boolean>() { @Override public Boolean answer( InvocationOnMock invocation ) throws Throwable { transMeta.clearChanged(); return true; } } ); delegate.createNewDataService( STEP_NAME ); verify( spoon ).saveToFile( transMeta ); verify( dialogBuilder ).serviceStep( STEP_NAME ); verify( dataServiceDialog ).open(); }