Skip to content

Commit 3911507

Browse files
committed
Prevent NAME environment variable from affecting test
Closes gh-45874
1 parent 7c2addd commit 3911507

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,12 @@ void loadWhenBindingTwoBeansShouldBind() {
302302
@Test
303303
void loadWhenBindingWithParentContextShouldBind() {
304304
AnnotationConfigApplicationContext parent = load(BasicConfiguration.class, "name=parent");
305+
assertThat(parent.getEnvironment().getProperty("name")).isEqualTo("parent");
305306
this.context = new AnnotationConfigApplicationContext();
306307
this.context.setParent(parent);
308+
removeSystemProperties();
307309
load(new Class<?>[] { BasicConfiguration.class, BasicPropertiesConsumer.class }, "name=child");
310+
assertThat(this.context.getEnvironment().getProperty("name")).isEqualTo("child");
308311
assertThat(this.context.getBean(BasicProperties.class)).isNotNull();
309312
assertThat(parent.getBean(BasicProperties.class)).isNotNull();
310313
assertThat(this.context.getBean(BasicPropertiesConsumer.class).getName()).isEqualTo("child");

0 commit comments

Comments
 (0)