@Test public void shouldPopulateResultWithErrorIfEnvNotFound() throws NoSuchEnvironmentException { HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); ConfigElementForEdit<EnvironmentConfig> edit = service.forEdit("foo-env", result); assertThat(result.message(localizer), is("Environment named 'foo-env' not found.")); assertThat(edit, is(nullValue())); }
@Test public void shouldReturnAClonedInstanceOfEnvironmentConfig() throws NoSuchEnvironmentException { HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); configHelper.addEnvironments("foo-env"); assertThat(service.named("foo-env"), sameInstance(service.named("foo-env"))); assertThat( service.named("foo-env"), not(sameInstance(service.forEdit("foo-env", result).getConfigElement()))); assertThat(result.isSuccessful(), is(true)); }