use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getDefaultWhenEnvironmentProfilesInBindNotationAndEnvironmentPropertyReturnsBoth.
@Test
void getDefaultWhenEnvironmentProfilesInBindNotationAndEnvironmentPropertyReturnsBoth() {
MockEnvironment environment = new MockEnvironment();
environment.setDefaultProfiles("a", "b", "c");
environment.setProperty("context.profiles.default[0]", "d");
environment.setProperty("context.profiles.default[1]", "e");
environment.setProperty("context.profiles.default[2]", "f");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("a", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWithProfileGroups.
@Test
void getActiveWithProfileGroups() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.active", "a,b,c");
environment.setProperty("context.profiles.group.a", "d,e");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).containsExactly("a", "d", "e", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getDefaultWhenNoEnvironmentProfilesAndEnvironmentPropertyInBindNotation.
@Test
void getDefaultWhenNoEnvironmentProfilesAndEnvironmentPropertyInBindNotation() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.default[0]", "a");
environment.setProperty("context.profiles.default[1]", "b");
environment.setProperty("context.profiles.default[2]", "c");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("a", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getDefaultWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray.
@Test
void getDefaultWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("default");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndBinderProperty.
@Test
void getActiveWhenNoEnvironmentProfilesAndBinderProperty() {
Environment environment = new MockEnvironment();
Binder binder = new Binder(new MapConfigurationPropertySource(Collections.singletonMap("context.profiles.active", "a,b,c")));
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).containsExactly("a", "b", "c");
}
Aggregations