package test
Type Members
- trait CleanMongoCollectionSupport extends MongoSupport with BeforeAndAfterEach
Calls prepareDatabase before each test, ensuring a clean database
- trait DefaultPlayMongoRepositorySupport[A] extends PlayMongoRepositorySupport[A] with CleanMongoCollectionSupport with IndexedMongoQueriesSupport with TtlIndexedMongoSupport
Provides all the typical mongo testing support.
Provides all the typical mongo testing support.
See PlayMongoRepositorySupport for setting up.
It will also:
- ensure the database is cleaned, and setup (with indexes and schemas) before each test
- ensure all queries have indices
- check that repositories have a ttl index, pointing at a Date field
- trait IndexedMongoQueriesSupport extends MongoSupport with BeforeAndAfterAll
Causes queries which don't use an index to generate com.mongodb.MongoQueryException or com.mongodb.MongoWriteException containing error code 291 (for mongo 4.4+ and error code 2 with message 'No query solutions' previously).
Causes queries which don't use an index to generate com.mongodb.MongoQueryException or com.mongodb.MongoWriteException containing error code 291 (for mongo 4.4+ and error code 2 with message 'No query solutions' previously).
Note, the notablescan option is a global server config. When running database tests with and without this trait, ensure that tests are not run in parallel.
- trait MongoSupport extends ScalaFutures
- trait PlayMongoRepositorySupport[A] extends MongoSupport
Specialises MongoSupport for PlayMongoRepository.
Specialises MongoSupport for PlayMongoRepository.
It is recommended to use DefaultPlayMongoRepositorySupport which brings this together with other useful testing support.
repository
will need overriding with the repository under test.
If a schema is not defined on the repository, it can still be provided for tests by overridding
optSchema
.
CRUD methods are provided which can help preparing and asserting repository behaviour.
optSchema }}}
CRUD methods are provided which can help preparing and asserting repository behaviour.
repository }}}
If a schema is not defined on the repository, it can still be provided for tests by overridding
optSchema
.
CRUD methods are provided which can help preparing and asserting repository behaviour.
optSchema }}}
CRUD methods are provided which can help preparing and asserting repository behaviour.
- trait TtlIndexedMongoSupport extends MongoSupport with TestSuite