/testcontainers-sample

Very simple artifact to show how testcontainers runs

Primary LanguageJava

Testcontainers

Sweet

For this example we will run an image from Docker Hub (hello-world) and then assert if the container is running ok

Usage

.gradlew test

Checkout this example

@Testcontainers
class LibraryTest {

    @Container
    private GenericContainer  helloWorld = new GenericContainer<>("hello-world");

    @Test void testSomeLibraryMethod() {
        assertTrue(helloWorld.getLogs().contains("Hello from Docker!"));
    }
}