Unit test for circular reference in default profile property, plus related polishing

Issue: SPR-12078
This commit is contained in:
Juergen Hoeller
2014-08-12 19:23:36 +02:00
parent 71c6eb2bb5
commit 8dbfa80b13
3 changed files with 38 additions and 28 deletions

View File

@@ -204,6 +204,17 @@ public class StandardEnvironmentTests {
System.getProperties().remove(DEFAULT_PROFILES_PROPERTY_NAME);
}
@Test(expected=IllegalArgumentException.class)
public void defaultProfileWithCircularPlaceholder() {
System.setProperty(DEFAULT_PROFILES_PROPERTY_NAME, "${spring.profiles.default}");
try {
environment.getDefaultProfiles();
}
finally {
System.getProperties().remove(DEFAULT_PROFILES_PROPERTY_NAME);
}
}
@Test
public void getActiveProfiles_systemPropertiesEmpty() {
assertThat(environment.getActiveProfiles().length, is(0));