September 2018
Intermediate to advanced
398 pages
9h 43m
English
We should also verify that three product rows are inserted when the application is started.
Create a test class, named ProductDaoSpec, which extends PlaySpec. Now, PlaySpec is the integration of ScalaTest in Play. The ProductDaoSpec class also needs to extend the GuiceOneAppPerSuite trait. This trait adds a new instance of the Application object to the ScalaTest suite:
class ProductDaoSpec extends PlaySpec with ScalaFutures with GuiceOneAppPerSuite { "ProductDao" should { "Have default rows on database creation" in { val app2dao = Application.instanceCache[ProductDao] val dao: ProductDao = app2dao(app) val expected = Set( Product("PEPPER", "ALD2", "PEPPER is a robot moving with wheels and with a screen as human interaction" ...
Read now
Unlock full access