I have worked spring boot + testcontainers test based on JUnit 4.
Example:
@RunWith(SpringRunner.class)
@SpringBootTest
public Test {
...
public void someTest() {
...
}
...
}
test properties:
spring:
datasource:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
url: jdbc:tc:mysql:5.6://hostname/db?TC_MY_CNF=mysql
username: user
password: pass
this test works properly, testcontainers uses JDBC Url string to initiate test container with MySQL 5.6.
Now I wanted to remove junit 4 from the project in favor to use JUnit 5.
Does testcontainers + Spring boot have ability to initiate containers in the similar way (by using JDBC URL) but using JUnit 5?
If yes - how to do it, or which workaround may be used here?
The JDBC URL style containers are testing framework agnostic, you can use it with any framework as long as you run it on JVM :)