Search in sources :

Example 1 with AbstractEnvironment

use of cn.taketoday.core.env.AbstractEnvironment in project today-infrastructure by TAKETODAY.

the class EnvironmentConverterTests method convertedEnvironmentHasSameActiveProfiles.

@Test
void convertedEnvironmentHasSameActiveProfiles() {
    AbstractEnvironment originalEnvironment = new MockEnvironment();
    originalEnvironment.setActiveProfiles("activeProfile1", "activeProfile2");
    StandardEnvironment convertedEnvironment = EnvironmentConverter.convertIfNecessary(getClass().getClassLoader(), originalEnvironment, StandardEnvironment.class);
    assertThat(convertedEnvironment.getActiveProfiles()).containsExactly("activeProfile1", "activeProfile2");
}
Also used : MockEnvironment(cn.taketoday.context.support.MockEnvironment) AbstractEnvironment(cn.taketoday.core.env.AbstractEnvironment) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Example 2 with AbstractEnvironment

use of cn.taketoday.core.env.AbstractEnvironment in project today-framework by TAKETODAY.

the class EnvironmentConverterTests method convertedEnvironmentHasSameConversionService.

@Test
void convertedEnvironmentHasSameConversionService() {
    AbstractEnvironment originalEnvironment = new MockEnvironment();
    ConfigurableConversionService conversionService = mock(ConfigurableConversionService.class);
    originalEnvironment.setConversionService(conversionService);
    StandardEnvironment convertedEnvironment = EnvironmentConverter.convertIfNecessary(getClass().getClassLoader(), originalEnvironment, StandardEnvironment.class);
    assertThat(convertedEnvironment.getConversionService()).isEqualTo(conversionService);
}
Also used : MockEnvironment(cn.taketoday.context.support.MockEnvironment) AbstractEnvironment(cn.taketoday.core.env.AbstractEnvironment) ConfigurableConversionService(cn.taketoday.core.conversion.support.ConfigurableConversionService) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Example 3 with AbstractEnvironment

use of cn.taketoday.core.env.AbstractEnvironment in project today-framework by TAKETODAY.

the class EnvironmentConverterTests method convertedEnvironmentHasSameActiveProfiles.

@Test
void convertedEnvironmentHasSameActiveProfiles() {
    AbstractEnvironment originalEnvironment = new MockEnvironment();
    originalEnvironment.setActiveProfiles("activeProfile1", "activeProfile2");
    StandardEnvironment convertedEnvironment = EnvironmentConverter.convertIfNecessary(getClass().getClassLoader(), originalEnvironment, StandardEnvironment.class);
    assertThat(convertedEnvironment.getActiveProfiles()).containsExactly("activeProfile1", "activeProfile2");
}
Also used : MockEnvironment(cn.taketoday.context.support.MockEnvironment) AbstractEnvironment(cn.taketoday.core.env.AbstractEnvironment) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Example 4 with AbstractEnvironment

use of cn.taketoday.core.env.AbstractEnvironment in project today-infrastructure by TAKETODAY.

the class EnvironmentConverterTests method convertedEnvironmentHasSameConversionService.

@Test
void convertedEnvironmentHasSameConversionService() {
    AbstractEnvironment originalEnvironment = new MockEnvironment();
    ConfigurableConversionService conversionService = mock(ConfigurableConversionService.class);
    originalEnvironment.setConversionService(conversionService);
    StandardEnvironment convertedEnvironment = EnvironmentConverter.convertIfNecessary(getClass().getClassLoader(), originalEnvironment, StandardEnvironment.class);
    assertThat(convertedEnvironment.getConversionService()).isEqualTo(conversionService);
}
Also used : MockEnvironment(cn.taketoday.context.support.MockEnvironment) AbstractEnvironment(cn.taketoday.core.env.AbstractEnvironment) ConfigurableConversionService(cn.taketoday.core.conversion.support.ConfigurableConversionService) StandardEnvironment(cn.taketoday.core.env.StandardEnvironment) Test(org.junit.jupiter.api.Test)

Aggregations

MockEnvironment (cn.taketoday.context.support.MockEnvironment)4 AbstractEnvironment (cn.taketoday.core.env.AbstractEnvironment)4 StandardEnvironment (cn.taketoday.core.env.StandardEnvironment)4 Test (org.junit.jupiter.api.Test)4 ConfigurableConversionService (cn.taketoday.core.conversion.support.ConfigurableConversionService)2