From ffebfebe317c253ea23c63274e0c6315894209fe Mon Sep 17 00:00:00 2001 From: "wenqi.huang" Date: Thu, 11 Apr 2019 18:02:24 +0800 Subject: [PATCH] Add more tests for @ConditionalOnRefreshScope --- .../eureka/ConditionalOnRefreshScopeTests.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java index 2afeebc7a..93487293c 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java @@ -43,6 +43,18 @@ public class ConditionalOnRefreshScopeTests { }); } + @Test + public void refreshScopeIncludedAndPropertyDisabled() { + new ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class)) + .withPropertyValues("eureka.client.refresh.enable=false") + .withUserConfiguration(Beans.class).run(c -> { + assertThat(c).hasSingleBean( + org.springframework.cloud.context.scope.refresh.RefreshScope.class); + assertThat(c).doesNotHaveBean("foo"); + }); + } + @Test public void refreshScopeNotIncluded() { new ApplicationContextRunner().withUserConfiguration(Beans.class).run(c -> { @@ -59,4 +71,4 @@ public class ConditionalOnRefreshScopeTests { } } -} \ No newline at end of file +}