public Map<String, String> buildFromMongoProperties(MongoProperties mongoProps) {
      Map<String, String> props = Maps.newHashMap();
      props.put("org.quartz.jobStore.class", "com.novemberain.quartz.mongodb.MongoDBJobStore");
      props.put("org.quartz.threadPool.threadCount", "1");
      if (uri == null) {
        Assert.notNull(mongoProps.getUri());
        uri = mongoProps.getUri();
      }
      String database = new MongoClientURI(uri).getDatabase();
      Assert.notNull(database);
      props.put("org.quartz.jobStore.dbName", database);

      if (!StringUtils.isEmpty(collectionPrefix)) {
        props.put("org.quartz.jobStore.collectionPrefix", collectionPrefix);
      }
      props.put("org.quartz.jobStore.mongoUri", uri);
      return props;
    }
  @Before
  public void beforeEachTest() {

    CodecRegistry codecRegistry =
        CodecRegistries.fromRegistries(
            MongoClient.getDefaultCodecRegistry(),
            CodecRegistries.fromCodecs(
                new LocalDateTimeCodec(), new HostAndPortCodec(), new LocalDateTimeCodec()));

    MongoProperties properties = new MongoProperties();

    MongoClient mongoClient =
        new MongoClient(
            new MongoClientURI(
                properties.getUri(), MongoClientOptions.builder().codecRegistry(codecRegistry)));

    mongoMetricsRepository =
        new MongoMetricsRepository(mongoClient, properties, new ObjectMapper());

    mongoMetricsRepository.init();

    metricsService = new MetricsService(mongoMetricsRepository);
  }