Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class CustomerRepositoryModuleIT extends Specification implements ExecutionTimeMeasurementSupport {
CustomerRepository customerRepository
def setup() {
startTimeMeasure()
PostgreSQLContainer container = new PostgreSQLContainer<>("postgres:9.6.17")
.withReuse(true)
.withUsername("testUser")
.withPassword("testUser")
.withDatabaseName("test_db")
.withInitScript("db/customer_database_schema.sql")
container.start()
Connection connection = DriverManager.getConnection(container.getJdbcUrl(), "testUser", "testUser")
stopTimeMeasure()
customerRepository = new CustomerRepository(connection)
}
def "should be able to retrieve saved customer"() {
// test code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment