### Question:
DefaultInstallationService implements InstallationService, Initializable { public void update( Installation installation ) throws InstallationException, AlreadyExistsInstallationException { try { Installation stored = getInstallation( installation.getInstallationId() ); if ( stored == null ) { throw new InstallationException( "installation with name " + installation.getName() + " not exists" ); } stored.setName( installation.getName() ); if ( alreadyExistInstallationName( installation ) ) { throw new AlreadyExistsInstallationException( "Installation with name " + installation.getName() + " already exists" ); } stored.setType( installation.getType() ); String envVarName = this.getEnvVar( installation.getType() ); if ( StringUtils.isNotEmpty( envVarName ) ) { installation.setVarName( envVarName ); } else { stored.setVarName( installation.getVarName() ); } stored.setVarValue( installation.getVarValue() ); installationDao.updateInstallation( stored ); } catch ( ContinuumStoreException e ) { throw new InstallationException( e.getMessage(), e ); } }  void initialize(); Installation add( Installation installation ); Installation add( Installation installation, boolean automaticProfile ); void delete( Installation installation ); @SuppressWarnings( "unchecked" ) List<Installation> getAllInstallations(); Installation getInstallation( int installationId ); Installation getInstallation( String installationName ); void update( Installation installation ); ExecutorConfigurator getExecutorConfigurator( String type ); String getEnvVar( String type ); List<String> getDefaultJavaVersionInfo(); List<String> getJavaVersionInfo( Installation installation ); List<String> getExecutorVersionInfo( String path, ExecutorConfigurator executorConfigurator,
                                                Profile profile );  }### Answer:
@Test public void testUpdate() throws Exception { String name = "toupdate"; Installation added = this.addInstallation( name, "foo", "bar", InstallationService.JDK_TYPE ); Installation getted = getInstallationService().getInstallation( added.getInstallationId() ); assertNotNull( getted ); assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ), getted.getVarName() ); assertEquals( "bar", getted.getVarValue() ); getted.setVarName( "updatefoo" ); getted.setVarValue( "updatedbar" ); getInstallationService().update( getted ); getted = getInstallationService().getInstallation( added.getInstallationId() ); assertNotNull( getted ); assertEquals( getInstallationService().getEnvVar( InstallationService.JDK_TYPE ), getted.getVarName() ); assertEquals( "updatedbar", getted.getVarValue() ); }