Testcontainers can be used to automatically instantiate and manage MinIO containers.
Create a MinIOContainer to use it in your tests:
Starting a MinIO container inside_block:minioContainer
The MinIO Java client can be configured with the container as such:
Configuring a MinIO client inside_block:configuringClient
If needed the username and password can be overridden as such:
Overriding a MinIO container inside_block:minioOverrides
Add the following dependency to your pom.xml/build.gradle file:
=== "Gradle"
groovy testImplementation "org.testcontainers:minio:{{latest_version}}"
=== "Maven"
xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>minio</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>