@Override
  protected void setupPrincipalDoesNotExist(KerberosOperationHandler handler, boolean service) throws Exception {
    NamingEnumeration<SearchResult> results = createMock(NamingEnumeration.class);
    results.close();
    expectLastCall().once();
    expect(results.hasMore()).andReturn(false).anyTimes();

    expect(ldapContext.search(anyObject(Name.class), anyString(), anyObject(SearchControls.class)))
        .andReturn(results)
        .anyTimes();
    ldapContext.close();
    expectLastCall().once();
  }
Implementation to illustrate the use of operations on this class

@throws Throwable
ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java