Test the application

For integration testing you generally need to replace components which are at the frontier of your system and deeply embedded in your application.

This is can be done with the replace method:

import org.zalando.grafter.syntax.rewriter._

trait Database
object mockDatabase extends Database {
  // mock the database operations

// you can also replace the production configuration!
val testConfiguration =
    replace[HttpConfig](HttpConfig("localhost", 8080))

// create the application from the test configuration
// and mock the database
val application: Application =


Note: due to a limitation with the rewriting, final case classes with one arguments cannot be replaced!

It is also particularly important to test that the application itself is properly configured.
Total for specification Test the application
Finished in18 ms
Results 0 example, 0 failure, 0 error