Unit tests in Play subprojects using a database fail due to this Error:
javax.persistence.PersistenceException: The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer()
It is thrown when doing something like this:
MyEntity entity = new MyEntity();
entity.save();
Also
server = Ebean.getServer("default");
won't work either -It would cause this error: java.lang.RuntimeException: DataSource user is null?
The only (very ugly) workaround that I have found is to move the Unit Test to the root Play project that hosts the subproject, which contains the model classes (MyEntity).
Has anybody an idea how to get the unit test working in the subproject?