Updated Question based upon feedback:
I have a spring-boot application that has three databases: H2 for integration testing, and Postgresql for
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