-
Notifications
You must be signed in to change notification settings - Fork 9
Testing and Build
./mvnw clean testMain sources compile for Java 17. Tests are configured for Java 25, and the Maven Enforcer configuration requires JDK 25 or newer for the build. Maven must be 3.6.3 or newer.
Surefire excludes *IT.java by default. The regular test suite includes model tests and in-memory database tests.
In-memory database coverage in the checked-out source includes:
| Database | Test class | JDBC URL |
|---|---|---|
| DuckDB | Memory_Duckdb_Test |
jdbc:duckdb: |
| H2 | Memory_H2_Test |
jdbc:h2:mem:test |
| HSQLDB | Memory_Hsql_Test |
jdbc:hsqldb:mem:test |
| SQLite | Memory_Sqlite_Test |
jdbc:sqlite::memory: |
There are also focused H2-based integration-style tests in the regular test source tree, including Context_ComparingInSpecifiedOrder_Test and Context_DirectMetadataMapping_IT. Files ending in *IT.java are excluded by Surefire unless the Failsafe profile is used.
Integration tests are run through the failsafe profile.
./mvnw -Pfailsafe verifyExternal database tests are documented separately on External Integration Tests. They use the base external profile
with one database-specific profile that contributes a concrete ExternalIT class and JDBC driver.
The project defines separate profiles that add Testcontainers dependencies and test source directories. Use the base
testcontainers profile together with one database-specific profile.
| Profile | Adds tests from |
|---|---|
testcontainers |
src/test/java-testcontainers |
testcontainers-db2 |
src/test/java-testcontainers-db2 |
testcontainers-mariadb |
src/test/java-testcontainers-mariadb |
testcontainers-mssqlserver |
src/test/java-testcontainers-mssqlserver |
testcontainers-mysql |
src/test/java-testcontainers-mysql |
testcontainers-oracle-free |
src/test/java-testcontainers-oracle-free |
testcontainers-oracle-xe |
src/test/java-testcontainers-oracle-xe |
testcontainers-postgresql |
src/test/java-testcontainers-postgresql |
Example:
./mvnw -Pfailsafe,testcontainers,testcontainers-postgresql verify| Database | Image |
|---|---|
| DB2 | ibmcom/db2:latest |
| MariaDB | mariadb:latest |
| MySQL | mysql:8 |
| Oracle Free | gvenzl/oracle-free:slim-faststart |
| Oracle XE | gvenzl/oracle-xe:latest-faststart |
| PostgreSQL | postgres:latest |
| SQL Server | mcr.microsoft.com/mssql/server:2022-latest |
Docker must be available for Testcontainers profiles.
The Maven build configures:
- Java 17 main compilation and Java 25 test compilation;
- Maven Enforcer checks for dependency convergence, JDK 25+, and Maven 3.6.3+;
- Error Prone and NullAway as compiler annotation processors;
- JSpecify annotations for nullness;
- Mockito's subclass mock maker for tests through
src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker; - JaCoCo report generation;
- Maven Javadoc, JXR, Checkstyle, and PMD reporting plugins;
- Apache License 2.0 checks through
license-maven-plugin.