@Test public void testDelete() throws Exception { RunConfigurationDeleteDialog dialog = mock( RunConfigurationDeleteDialog.class ); whenNew( RunConfigurationDeleteDialog.class ).withAnyArguments().thenReturn( dialog ); DefaultRunConfiguration config = new DefaultRunConfiguration(); config.setName( "Test" ); config.setServer( "localhost" ); doReturn( SWT.YES ).when( dialog ).open(); delegate.delete( config ); verify( service, times( 1 ) ).delete( "Test" ); verify( spoon, times( 1 ) ).refreshTree(); }
public void delete( RunConfiguration runConfiguration ) { RunConfigurationDeleteDialog deleteDialog = new RunConfigurationDeleteDialog( spoonSupplier.get().getShell() ); int response = deleteDialog.open(); if ( response == SWT.YES ) { configurationManager.delete( runConfiguration.getName() ); spoonSupplier.get().refreshTree(); } }
RunConfigurationDelegate { public void delete( RunConfiguration runConfiguration ) { RunConfigurationDeleteDialog deleteDialog = new RunConfigurationDeleteDialog( spoonSupplier.get().getShell() ); int response = deleteDialog.open(); if ( response == SWT.YES ) { configurationManager.delete( runConfiguration.getName() ); spoonSupplier.get().refreshTree(); } } }
RunConfigurationDelegate { public void delete( RunConfiguration runConfiguration ) { RunConfigurationDeleteDialog deleteDialog = new RunConfigurationDeleteDialog( spoonSupplier.get().getShell() ); int response = deleteDialog.open(); if ( response == SWT.YES ) { configurationManager.delete( runConfiguration.getName() ); spoonSupplier.get().refreshTree(); } } RunConfigurationDelegate( RunConfigurationService configurationManager ); }
RunConfigurationDelegate { public void delete( RunConfiguration runConfiguration ) { RunConfigurationDeleteDialog deleteDialog = new RunConfigurationDeleteDialog( spoonSupplier.get().getShell() ); int response = deleteDialog.open(); if ( response == SWT.YES ) { configurationManager.delete( runConfiguration.getName() ); spoonSupplier.get().refreshTree(); } } RunConfigurationDelegate( RunConfigurationService configurationManager ); void edit( RunConfiguration runConfiguration ); void delete( RunConfiguration runConfiguration ); void create(); List<RunConfiguration> load(); }
RunConfigurationDelegate { public void delete( RunConfiguration runConfiguration ) { RunConfigurationDeleteDialog deleteDialog = new RunConfigurationDeleteDialog( spoonSupplier.get().getShell() ); int response = deleteDialog.open(); if ( response == SWT.YES ) { configurationManager.delete( runConfiguration.getName() ); spoonSupplier.get().refreshTree(); } } RunConfigurationDelegate( RunConfigurationService configurationManager ); void edit( RunConfiguration runConfiguration ); void delete( RunConfiguration runConfiguration ); void create(); List<RunConfiguration> load();  }