@Test
  public void shouldLdapTemplateBeInstantiated() throws Exception {
    // GIVEN
    // the injector is set up
    Assert.assertNotNull(injector);

    // WHEN
    LdapConnectionTemplateFactory ldapConnectionTemplateFactory = injector.getInstance(LdapConnectionTemplateFactory.class);
    AmbariLdapConfiguration ldapConfiguration = new AmbariLdapConfiguration(getProps());
    LdapConnectionTemplate template = ldapConnectionTemplateFactory.create(ldapConfiguration);

    // THEN
    Assert.assertNotNull(template);
    //template.authenticate(new Dn("cn=read-only-admin,dc=example,dc=com"), "password".toCharArray());

    Boolean success = template.execute(new ConnectionCallback<Boolean>() {
      @Override
      public Boolean doWithConnection(LdapConnection connection) throws LdapException {

        return connection.isConnected() && connection.isAuthenticated();
      }
    });

    Assert.assertTrue("Could not bind to the LDAP server", success);

  }
Test for the GUICE LdapModule setup

- checks the module's bindings (can the GUICE context be created properely)
- checks for specific instances in the GUICE context (re they constructed properly, what is the instance' scope)

It's named functional test as it creates a GUICE context. ("Real" unit tests only mock a class' collaborators, and
are more lightweight)

By default the test is ignored, as it connects to external LDAP instances, thus in different environments may fail
ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java