Allows embedding PostgreSQL into Java application code with no external dependencies. Excellent for allowing you to unit test with a "real" Postgres without requiring end users to install and set up a database cluster.
In your JUnit test just add:
@Rule
public EmbeddedPostgreSQLRule pg = new EmbeddedPostgreSQLRule();
This simply has JUnit manage an instance of EmbeddedPostgreSQLRule (start, stop). You can then use this to get a DataSource with: pg.getEmbeddedPostgreSQL().getPostgresDatabase();
Additionally you may use the EmbeddedPostgreSQL
class directly by manually starting and stopping the instance; see EmbeddedPostgreSQLTest
for an example.
Copyright (C) 2014 OpenTable, Inc