@Test
public void testGetLdapUserByMemberAttrNoPagination() throws Exception {

  Configuration configuration = createNiceMock(Configuration.class);
  Users users = createNiceMock(Users.class);
  LdapTemplate ldapTemplate = createNiceMock(LdapTemplate.class);
  LdapServerProperties ldapServerProperties = createNiceMock(LdapServerProperties.class);
  Capture<ContextMapper> contextMapperCapture = EasyMock.newCapture();
  Capture<SearchControls> searchControlsCapture = EasyMock.newCapture();
  PagedResultsDirContextProcessor processor = createNiceMock(PagedResultsDirContextProcessor.class);
  PagedResultsCookie cookie = createNiceMock(PagedResultsCookie.class);
  LdapUserDto dto = new LdapUserDto();
  List<LdapUserDto> list = new LinkedList<LdapUserDto>();
  list.add(dto);
  expect(configuration.getLdapServerProperties()).andReturn(ldapServerProperties).anyTimes();
  expect(ldapServerProperties.isPaginationEnabled()).andReturn(false).anyTimes();
  expect(ldapServerProperties.getUserObjectClass()).andReturn("objectClass").anyTimes();
  expect(ldapServerProperties.getUsernameAttribute()).andReturn("uid").anyTimes();
  expect(ldapServerProperties.getDnAttribute()).andReturn("dn").anyTimes();
  expect(ldapServerProperties.getBaseDN()).andReturn("cn=testUser,ou=Ambari,dc=SME,dc=support,dc=com").anyTimes();
  expect(ldapTemplate.search(eq(LdapUtils.newLdapName("cn=testUser,ou=Ambari,dc=SME,dc=support,dc=com") ), eq("(&(objectClass=objectClass)(uid=foo))"), anyObject(SearchControls.class), capture(contextMapperCapture))).andReturn(list);
  replay(ldapTemplate, ldapServerProperties, users, configuration, processor, cookie);
  AmbariLdapDataPopulatorTestInstance populator = new AmbariLdapDataPopulatorTestInstance(configuration, users);
  populator.setLdapTemplate(ldapTemplate);
  populator.setProcessor(processor);
  assertEquals(dto, populator.getLdapUserByMemberAttr("foo"));
  verify(ldapTemplate, ldapServerProperties, users, configuration, processor, cookie);
}