use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method iteratorWithProfileGroups.
@Test
void iteratorWithProfileGroups() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.active", "a,b,c");
environment.setProperty("context.profiles.group.a", "e,f");
environment.setProperty("context.profiles.group.e", "x,y");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles).containsExactly("a", "e", "x", "y", "f", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method iteratorIteratesAllActiveProfiles.
@Test
void iteratorIteratesAllActiveProfiles() {
MockEnvironment environment = new MockEnvironment();
environment.setActiveProfiles("a", "b", "c");
environment.setDefaultProfiles("d", "e", "f");
Binder binder = Binder.get(environment);
Profiles profiles1 = new Profiles(environment, binder, null);
Profiles profiles = profiles1;
assertThat(profiles).containsExactly("a", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndEnvironmentPropertyInBindNotation.
@Test
void getActiveWhenNoEnvironmentProfilesAndEnvironmentPropertyInBindNotation() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.active[0]", "a");
environment.setProperty("context.profiles.active[1]", "b");
environment.setProperty("context.profiles.active[2]", "c");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).containsExactly("a", "b", "c");
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method isAcceptedWithGroupsReturnsTrue.
@Test
void isAcceptedWithGroupsReturnsTrue() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.active", "a,b,c");
environment.setProperty("context.profiles.group.a", "e,f");
environment.setProperty("context.profiles.group.e", "x,y");
environment.setDefaultProfiles("g", "h", "i");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.isAccepted("a")).isTrue();
assertThat(profiles.isAccepted("e")).isTrue();
assertThat(profiles.isAccepted("g")).isFalse();
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getDefaultWithProfileGroups.
@Test
void getDefaultWithProfileGroups() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.default", "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.getDefault()).containsExactly("a", "d", "e", "b", "c");
}
Aggregations