use of cn.taketoday.core.env.StandardEnvironment in project today-framework by TAKETODAY.
the class ClassPathScanningCandidateComponentProviderTests method testWithActiveProfile.
@Test
public void testWithActiveProfile() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
ConfigurableEnvironment env = new StandardEnvironment();
env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
provider.setEnvironment(env);
Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class)).isTrue();
}
Aggregations