Add more tests for @ConditionalOnRefreshScope

This commit is contained in:
wenqi.huang
2019-04-11 18:02:24 +08:00
parent bf1cc4d270
commit ffebfebe31

View File

@@ -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 {
}
}
}
}