Reputation: 9579
In Play 2 Framework we can create in memory database for testing purposes and then load yaml file into the DD.
@Before
public void setUp() {
start(fakeApplication(inMemoryDatabase()));
}
Ebean.save((List) Yaml.load("test-data.yml"));
The question is how to easily clean the DB (drop all tables)?
Something like Ebean.clean()
or Ebean.dropAll()
, but it does not exist.
Upvotes: 0
Views: 420
Reputation: 12850
inMemoryDatabase()
uses a random database name, so each time you create it, it should return you a new database. Nevertheless, if you want to drop all tables, just create an @After
method, and use the DB
class to get a jdbc connection, then you can issue a drop database SQL statement.
Upvotes: 2