@BeforeEach
    void initialize() {
        val mongo = casProperties.getAuthn().getMongo();
        val factory = new MongoDbConnectionFactory();
        try (val mongoClient = factory.buildMongoDbClient(mongo)) {
            val database = mongoClient.getDatabase(mongo.getDatabaseName());
            database.drop();
            val col = database.getCollection(mongo.getCollection());

            var account = new Document();
            account.append(mongo.getUsernameAttribute(), "u1");
            account.append(mongo.getPasswordAttribute(), "p1");
            account.append("loc", "Apereo");
            account.append("state", "California");
            col.insertOne(account);

            account = new Document();
            account.append(mongo.getUsernameAttribute(), "userPlain");
            col.insertOne(account);
        }
    }
Test cases for {@link MongoDbAuthenticationHandler}.

@author Misagh Moayyed
@since 4.2
support/cas-server-support-mongo/src/test/java/org/apereo/cas/authentication/MongoDbAuthenticationHandlerTests.java