02 June 2019

I have just released org.firebirdsql:firebird-testcontainers-java:1.0.0, based on Testcontainers.

This library allows you to start a Firebird docker container for a JUnit 4 or 5 test or manually from your code. This can be useful for JUnit-based integration tests.

For a very simple example, add to your pom.xml:


And create a test:

  * Simple test demonstrating use of {@code @Rule}.
public class ContainerExampleTest {

     public final FirebirdContainer container = new FirebirdContainer();

     public void canConnectToContainer() throws Exception {
         try (Connection connection = DriverManager
                 .getConnection(container.getJdbcUrl(), container.getUsername(),
              Statement stmt = connection.createStatement();
              ResultSet rs = stmt.executeQuery("select CURRENT_USER from RDB$DATABASE")) {
             assertTrue("has row", rs.next());
             assertEquals("user name",
                 container.getUsername().toUpperCase(), rs.getString(1));