I try to perform some JUnit test in PlayFramework 2.3.8 I would like this test to be performed in the in memory database, so that I keep the "real" database untouched. This it what I've done:
public class SaveToolsTest extends WithApplication{
@Before
public void startApp(){
// Start the app in the in memory database.
Map<String, String> settings = new HashMap<String, String>();
settings.put("db.default.url", "jdbc:h2:mem:play");
settings.put("db.default.user", "");
settings.put("db.default.password", "");
app = Helpers.fakeApplication(settings);
Helpers.start(app);
}
@Test
public void saveUser(){
User user = createUser();
// Save the user into DB.
Ebean.save(user);
// Test if user != null
assertNotNull(user);
assertThat(user.id).isNotNull();
}
But by doing this, I connect the test to the actual db. How can I connect it to an in memory db?