For this example we will run an image from Docker Hub (hello-world) and then assert if the container is running ok
.gradlew test
@Testcontainers
class LibraryTest {
@Container
private GenericContainer helloWorld = new GenericContainer<>("hello-world");
@Test void testSomeLibraryMethod() {
assertTrue(helloWorld.getLogs().contains("Hello from Docker!"));
}
}