From 20dd5da52c6cd1884c9aec2c1822d70a8f8c480e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 19 Oct 2017 13:59:13 +0100 Subject: [PATCH] Fix test to accommodate changed property source order --- .../cloud/context/refresh/ContextRefresherTests.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-cloud-context/src/test/java/org/springframework/cloud/context/refresh/ContextRefresherTests.java b/spring-cloud-context/src/test/java/org/springframework/cloud/context/refresh/ContextRefresherTests.java index 1c1a0251..9309c9a1 100644 --- a/spring-cloud-context/src/test/java/org/springframework/cloud/context/refresh/ContextRefresherTests.java +++ b/spring-cloud-context/src/test/java/org/springframework/cloud/context/refresh/ContextRefresherTests.java @@ -12,7 +12,7 @@ import org.junit.After; import org.junit.Test; import org.mockito.Mockito; import org.springframework.boot.SpringApplication; -import org.springframework.boot.test.util.EnvironmentTestUtils; +import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.cloud.bootstrap.config.PropertySourceLocator; import org.springframework.cloud.context.scope.refresh.RefreshScope; import org.springframework.context.ConfigurableApplicationContext; @@ -49,8 +49,8 @@ public class ContextRefresherTests { assertThat(names) .contains("applicationConfig: [classpath:/bootstrap-refresh.properties]"); assertThat(names).containsSequence( - "applicationConfig: [classpath:/bootstrap-refresh.properties]", - "applicationConfig: [classpath:/bootstrap.properties]"); + "applicationConfig: [classpath:/application.properties]", + "applicationConfig: [classpath:/bootstrap-refresh.properties]"); } @Test @@ -63,9 +63,9 @@ public class ContextRefresherTests { List names = names(context.getEnvironment().getPropertySources()); assertThat(names).doesNotContain("bootstrapProperties"); ContextRefresher refresher = new ContextRefresher(context, scope); - EnvironmentTestUtils.addEnvironment(context, - "spring.cloud.bootstrap.sources: org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration\n" - + ""); + TestPropertyValues.of( + "spring.cloud.bootstrap.sources: org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration") + .applyTo(context); refresher.refresh(); names = names(context.getEnvironment().getPropertySources()); assertThat(names).first().isEqualTo("bootstrapProperties");