Hi, not really sure if you solved it or not, but we have similar setup and this is how I did it (it might also help someone else):
public class IntegrationTest {
protected static Application app;
//overwriting application.conf file
private static final Map<String, Object> configMap = ImmutableMap.<String, Object>builder()
.put("db.default.driver", "org.h2.Driver")
.put("db.default.url", "jdbc:h2:mem:test")
.put("db.default.username", "sa")
.put("db.default.password", "")
.put("play.evolutions.enabled", "false")
.build();
@BeforeClass
public static void provideApplication() {
Config config = ConfigFactory.parseMap(configMap);
app = new GuiceApplicationBuilder().configure(config).build();
Helpers.start(app);
}
@AfterClass
public static void stopApp() {
Helpers.stop(app);
app = null;
}
@Test
public void testIndex() {
Http.RequestBuilder request = new Http.RequestBuilder()
.method(GET)
.uri("/");
Result result = route(app, request);
assertEquals(OK, result.status());
assertEquals("There must be 3 records", play.test.Helpers.contentAsString(result), "3");
}
}
Above code will overwrite default application.conf configuration with new one. Then as we also want to load seed.sql data, I have test-ebean.properties file under resources with content:
ebean.ddl.generate=true
ebean.ddl.run=true
ebean.ddl.seedsql=seed.sql
This will now generate and run migrationd and load all SQLs from seed.sql into inmemory db.
Regards