public Map<String, LdapContextFactory> getContextFactories() {
    if (contextFactories == null) {
      contextFactories = new LinkedHashMap<>();
      String[] serverKeys = config.getStringArray(LDAP_SERVERS_PROPERTY);
      if (serverKeys.length > 0) {
        initMultiLdapConfiguration(serverKeys);
      } else {
        initSimpleLdapConfiguration();
      }
    }
    return contextFactories;
  }
@Test
  public void testContextFactoriesWithSingleLdap() {
    LdapSettingsManager settingsManager = new LdapSettingsManager(
      generateSingleLdapSettingsWithUserAndGroupMapping().asConfig());
    assertThat(settingsManager.getContextFactories()).hasSize(1);
  }