/** Test with empty key. */
  @Test
  public void testEmptyKey() {
    LdapGroupDnLdapTemplateRetriever sut =
        new LdapGroupDnLdapTemplateRetriever(ldapTemplates, defaultLdapTemplate);

    context.checking(
        new Expectations() {
          {
            allowing(ldapLookupRequest).getTemplateKey();
            will(returnValue(""));
          }
        });

    LdapTemplate result = sut.getLdapTemplate(ldapLookupRequest);
    assertEquals(defaultLdapTemplate, result);
    context.assertIsSatisfied();
  }
  /** Test with key found. */
  @Test
  public void testKeyFound() {
    ldapTemplates.put("key", mappedLdapTemplate1);
    LdapGroupDnLdapTemplateRetriever sut =
        new LdapGroupDnLdapTemplateRetriever(ldapTemplates, defaultLdapTemplate);

    context.checking(
        new Expectations() {
          {
            allowing(ldapLookupRequest).getTemplateKey();
            will(returnValue("cn=blah,dc=key"));
          }
        });

    LdapTemplate result = sut.getLdapTemplate(ldapLookupRequest);
    assertEquals(mappedLdapTemplate1, result);
    context.assertIsSatisfied();
  }