DataServiceDelegate extends DataServiceFactory { public void suggestEdit( DataServiceMeta dataServiceMeta, String title, String text ) { TransMeta serviceTrans = dataServiceMeta.getServiceTrans(); if ( !serviceTrans.hasChanged() ) { if ( showPrompt( title, text ) ) { editDataService( dataServiceMeta ); serviceTrans.setChanged(); } else { try { deleteDataServiceElementAndCleanCache( dataServiceMeta, serviceTrans ); serviceTrans.setChanged(); } catch ( MetaStoreException e ) { getLogChannel().logBasic( e.getMessage() ); } } } } 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 testSuggestEdit() throws Exception { when( messageBox.open() ).thenReturn( SWT.YES ); delegate.suggestEdit( dataService, TITLE, TEXT ); assertThat( transMeta.hasChanged(), is( true ) ); }
@Test public void testSuggestEditNo() throws Exception { delegate = spy( delegate ); when( messageBox.open() ).thenReturn( SWT.NO ); delegate.suggestEdit( dataService, TITLE, TEXT ); Mockito.verify( delegate, Mockito.times( 1 ) ). deleteDataServiceElementAndCleanCache( dataService, transMeta ); }