See Database containers for documentation and usage that is common to all relational database container types.
Running Oracle XE as a stand-in for in a test:
public class SomeTest {
@Rule
public OracleContainer oracle = new OracleContainer("name_of_your_oracle_xe_image");
@Test
public void someTestMethod() {
String url = oracle.getJdbcUrl();
... create a connection and run test as normalIf you do not pass an image name to the OracleContainer constructor, a suitable image name should be placed in
configuration instead.
To do this, please place a file on the classpath named testcontainers.properties,
containing oracle.container.image=IMAGE, where IMAGE is a suitable image name and tag.
Add the following dependency to your pom.xml/build.gradle file:
testCompile "org.testcontainers:oracle-xe:{{latest_version}}"<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>!!! hint Adding this Testcontainers library JAR will not automatically add a database driver JAR to your project. You should ensure that your project also has a suitable database driver as a dependency.