Package org.mongounit

Annotation Interface MongoUnitTest


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited @ExtendWith(MongoUnitExtension.class) @ImportAutoConfiguration(classes=MongoUnitConfiguration.class) public @interface MongoUnitTest
MongoUnitTest is an annotation meant to be placed on JUnit classes to autoconfigure the Spring-based MongoDatabaseFactory to use a test database for the integration tests.

Placing this annotation on a test class automatically triggers the MongoUnit framework to look for them as system properties or to look for the 'mongounit.properties' file at the root of the classpath. If such a file is not found, the following defaults are used:

mongounit.base-uri = mongodb://localhost:27017/mongounit-testdb

mongounit.base-uri.keep-as-is = false

mongounit.drop-database = true

mongounit.indicator-field-name = $$

mongounit.local-time-zone-id = UTC

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Element Details

    • name

      String name
      Returns:
      The class name of this test. This property affects what subfolder name and class-level dataset name is automatically looked for when resolving locations for the datasets specified in SeedWithDataset and AssertMatchesDataset annotations. The default is an empty string, which triggers MongoUnit framework to use the simple class name this annotation is on as the name for the subfolder and the class-level dataset name.
      Default:
      ""