### Question:
RunConfigurationDelegate { public void edit( RunConfiguration runConfiguration ) { final String key = runConfiguration.getName(); RunConfigurationDialog dialog = new RunConfigurationDialog( spoonSupplier.get().getShell(), configurationManager, runConfiguration ); RunConfiguration savedRunConfiguration = dialog.open(); if ( savedRunConfiguration != null ) { configurationManager.delete( key ); configurationManager.save( savedRunConfiguration ); spoonSupplier.get().refreshTree(); updateLoadedJobs( key, savedRunConfiguration ); } } RunConfigurationDelegate( RunConfigurationService configurationManager ); void edit( RunConfiguration runConfiguration ); void delete( RunConfiguration runConfiguration ); void create(); List<RunConfiguration> load();  }### Answer:
@Test public void testEdit() throws Exception { RunConfigurationDialog dialog = mock( RunConfigurationDialog.class ); whenNew( RunConfigurationDialog.class ).withAnyArguments().thenReturn( dialog ); DefaultRunConfiguration config = new DefaultRunConfiguration(); config.setName( "Test" ); config.setServer( "localhost" ); doReturn( config ).when( dialog ).open(); doNothing().when( delegate ).updateLoadedJobs( "Test", config ); delegate.edit( config ); verify( delegate, times( 1 ) ).updateLoadedJobs( "Test", config ); verify( service, times( 1 ) ).delete( "Test" ); verify( service, times( 1 ) ).save( config ); verify( spoon, times( 1 ) ).refreshTree(); }