The brand new 0.6 release of the Embedded DB JUnit Rule has been released with some notable new features: * A new initialization plugin API * Liquibase support by implementing the new initialization plugin

A new initialization plugin API

You can now implement custom initialization code by implementing the new InitializationPlugin interface:

public interface InitializationPlugin {

    void connectionMade(final String name, final Connection connection);

Liquibase support

To initiate the embedded in-memory H2 database created by the @Rule, add the plugin to the @Rule initialization using the fluent Builder API:

public EmbeddedDatabaseRule embeddedDatabaseRule = EmbeddedDatabaseRule

You can then get a DataSource or Connection from the JUnit rule to be used in your test

public void testCanConnect() throws Exception {

    try(final Connection connection = embeddedDatabaseRule.getConnection()) {
        // test code