uk.gov.hmrc.mongo.test

Members list

Type members

Classlikes

trait CleanMongoCollectionSupport extends MongoSupport, BeforeAndAfterEach

Calls prepareDatabase before each test, ensuring a clean database

Calls prepareDatabase before each test, ensuring a clean database

Attributes

Supertypes
trait BeforeAndAfterEach
trait SuiteMixin
trait MongoSupport
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Known subtypes
Self type
TestSuite

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

Attributes

Supertypes
trait TestSuite
trait Suite
trait Serializable
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
trait BeforeAndAfterAll
trait BeforeAndAfterEach
trait SuiteMixin
trait MongoSupport
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Self type
TestSuite
trait IndexedMongoQueriesSupport extends MongoSupport, 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.

Attributes

Supertypes
trait BeforeAndAfterAll
trait SuiteMixin
trait MongoSupport
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Known subtypes
Self type
TestSuite
trait MongoSupport extends ScalaFutures

Attributes

Supertypes
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Known subtypes

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.

Attributes

Supertypes
trait MongoSupport
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Known subtypes
trait TtlIndexedMongoSupport extends MongoSupport, TestSuite

Attributes

Supertypes
trait TestSuite
trait Suite
trait Serializable
trait Assertions
trait TripleEquals
trait TripleEqualsSupport
trait MongoSupport
trait ScalaFutures
trait Futures
trait PatienceConfiguration
trait AbstractPatienceConfiguration
trait ScaledTimeSpans
class Object
trait Matchable
class Any
Show all
Known subtypes