MongoDBDocumentConfiguration implements DocumentConfiguration { public MongoDBDocumentCollectionManagerFactory get(Map<String, String> configurations) throws NullPointerException { requireNonNull(configurations, "configurations is required"); SettingsBuilder builder = Settings.builder(); configurations.entrySet().forEach(e -> builder.put(e.getKey(), e.getValue())); return get(builder.build()); }  MongoDBDocumentCollectionManagerFactory get(Map<String, String> configurations); MongoDBDocumentCollectionManagerFactory get(MongoClient mongoClient); @Override MongoDBDocumentCollectionManagerFactory get(); @Override MongoDBDocumentCollectionManagerFactory get(Settings settings); MongoDBDocumentCollectionManagerFactory get(String pathFileConfig);  }
@Test public void shouldCreateDocumentCollectionManagerFactoryByMap() { Map<String, String> map = new HashMap<>(); map.put("mongodb-server-host-1", "172.17.0.2:27017"); MongoDBDocumentConfiguration configuration = new MongoDBDocumentConfiguration(); DocumentCollectionManagerFactory managerFactory = configuration.get(map); assertNotNull(managerFactory); }
@Test public void shouldCreateDocumentCollectionManagerFactoryByFile() { DocumentConfiguration configuration = new MongoDBDocumentConfiguration(); DocumentCollectionManagerFactory managerFactory = configuration.get(); assertNotNull(managerFactory); }
@Test public void shouldReturnErrorWhendSettingsIsNull() { DocumentConfiguration configuration = new MongoDBDocumentConfiguration(); assertThrows(NullPointerException.class, () -> configuration.get(null)); }
@Test public void shouldReturnErrorWhendMapSettingsIsNull() { MongoDBDocumentConfiguration configuration = new MongoDBDocumentConfiguration(); assertThrows(NullPointerException.class, () -> configuration.get((Map) null)); }