Interface MongoDbClassExtension
- All Superinterfaces:
org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.Extension
,MongoDb
- All Known Implementing Classes:
StartLocalMongoDbClassExtension
,UseExistingMongoDbClassExtension
public interface MongoDbClassExtension
extends MongoDb, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
JUnit 5 Extension for running a MongoDB instance alongside the (integration) tests. Can be
configured with custom user credentials and database name. Use
MongoDb.getConnectionString()
*
to retrieve the connection string.
Example usage:
@RegisterExtension @Order(0) static final MongoDbClassExtension MONGO_DB_EXTENSION = MongoDbClassExtension .builder() .withDatabase("my_db") .withUsername("my_user") .withPassword("my_s3cr3t") .build();
Normally a MongoDb is started on demand. For connecting to an already running MongoDb set the
environment variable TEST_MONGODB_CONNECTION_STRING
.
-
Nested Class Summary
-
Field Summary
Fields inherited from interface org.sdase.commons.server.mongo.testing.MongoDb
OVERRIDE_MONGODB_CONNECTION_STRING_SYSTEM_PROPERTY_NAME
-
Method Summary
Methods inherited from interface org.junit.jupiter.api.extension.AfterAllCallback
afterAll
Methods inherited from interface org.junit.jupiter.api.extension.BeforeAllCallback
beforeAll
Methods inherited from interface org.sdase.commons.server.mongo.testing.MongoDb
clearCollections, clearDatabase, createClient, getConnectionString, getMongoConnectionString, getServerVersion
-
Method Details
-
builder
-