Updated Question based upon feedback:
I have a spring-boot application that has three databases: H2 for integration testing, and Postgresql for
See section 21.3 of the Spring Boot documentation. This section describes how to define profile specific property files that use the format application-{profile}.properties. This can help you isolate properties on a per profile basis.
You can annotate your tests adding @ActiveProfiles in the following way:
@SpringApplicationConfiguration(classes = {Application.class, TestSpringConfiguration.class})
@Test(groups = "integration")
@ActiveProfiles("test")
public class MyServiceTest extends AbstractTransactionalTestNGSpringContextTests {
...
@Test
public void testSomething() {
...
}
}
I'm using TestNG but JUnint wouldn't be much different. You can also specify additional configuration as showed in the example above.
That way you won't need to set the profile in build.gradle or launch configuration in IntelliJ