I try to migrate my Integration Test Class to use @Testcontainers.
Original Test Class was like
@QuarkusTest
class GameResourceTest {
@Inject
TeamService teamService;
@Test
void shouldLeadTheRankLadder() {
teamService.doCrazyStuff(); // PASS
After rewrite it looks like this
@Testcontainers
class GameResourceTest {
@Container
private MariaDBContainer mariaDBContainer = new MariaDBContainer("mariadb:10.5.16").withDatabaseName("test").withUsername("test").withPassword("test");
@Inject
TeamService teamService;
@Test
void test() {
assertTrue(mariaDBContainer.isRunning()); // PASS
}
@Test
void shouldLeadTheRankLadder() {
teamService <-----------------------IS NULL HERE
So after removing the @QuarkusTest annoation, dependency injection of my service not work anymore.
How to use Testcontainers and Dependency Injection here?