use of cn.taketoday.mock.env.MockEnvironment in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray.
@Test
void getActiveWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).isEmpty();
}
use of cn.taketoday.mock.env.MockEnvironment 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.mock.env.MockEnvironment 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.mock.env.MockEnvironment 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.mock.env.MockEnvironment 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");
}
Aggregations