Created
March 13, 2016 14:21
-
-
Save antonevane/dbad3846f65c5a7f0d4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.IntegrationTest; | |
import org.springframework.boot.test.SpringApplicationConfiguration; | |
import org.springframework.core.env.ConfigurableEnvironment; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
import org.springframework.test.context.web.WebAppConfiguration; | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@SpringApplicationConfiguration(classes = Application.class) | |
@WebAppConfiguration | |
@IntegrationTest("server.port:0") | |
public class EnvironmentTest { | |
@Autowired | |
private ConfigurableEnvironment environment; | |
@Test | |
public void testProfile() { | |
System.out.println("########################"); | |
// Set Active Environment | |
environment.setActiveProfiles("dev"); | |
System.out.println(Arrays.toString(environment.getActiveProfiles())); | |
System.out.println(Arrays.toString(environment.getDefaultProfiles())); | |
System.out.println("########################"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment