testcontainers-junit5

How to test repository with junit5 and testcontainers?

六月ゝ 毕业季﹏ 提交于 2021-01-29 08:12:19
问题 I have a sample project in which I experiment with different technologies. I have the following setup: Spring Boot 2.3.4.RELEASE Flyway 7.0.1 Testcontainers 1.15.0-rc2 Junit 5.7.0 How can I test the Repository layer with testcontainer-junit5? Example of code I have now for CompanyRepositoryTest.java : @ExtendWith(SpringExtension.class) @Testcontainers public class CompanyRepositoryTest { @Autowired private CompanyRepository companyRepository; @Container public MySQLContainer mysqlContainer =