public void start(final int port) {
            var starter = MongodStarter.getDefaultInstance();
            try {
                var mongodConfig = MongodConfig.builder()
                    .version(Version.Main.PRODUCTION)
                    .net(new Net(port, Network.localhostIsIPv6()))
                    .build();

                mongodExecutable = starter.prepare(mongodConfig);
                mongodExecutable.start();
                val mongo = MongoClients.create(String.format("mongodb://localhost:%d", port));
                val db = mongo.getDatabase("saml2");
                db.createCollection("metadata");
            } catch (final IOException e) {
                throw new RuntimeException(e);
            }
        }
This is {@link SAML2MongoMetadataGeneratorIT}.

@author Misagh Moayyed
@since 5.7.0
pac4j-saml/src/test/java/org/pac4j/saml/metadata/mongo/SAML2MongoMetadataGeneratorIT.java