@Test
public void testEquals()
{

  final SearchResponse sr1 = SearchResponse.builder().build();
  Assert.assertEquals(sr1, sr1);
  Assert.assertEquals(SearchResponse.builder().build(), SearchResponse.builder().build());
  Assert.assertEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(2)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.NO_SUCH_OBJECT)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=2")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message 2")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=2,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uuid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("2").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
  Assert.assertNotEquals(
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-4.ldaptive.org").build())
      .build(),
    SearchResponse.builder()
      .messageID(1)
      .controls(new PasswordPolicyControl())
      .resultCode(ResultCode.SUCCESS)
      .matchedDN("uid=1")
      .diagnosticMessage("sample message")
      .referralURLs("ldap://directory-1.ldaptive.org", "ldap://directory-2.ldaptive.org")
      .entry(LdapEntry.builder()
        .dn("uid=1,dc=ldaptive,dc=org")
        .attributes(LdapAttribute.builder().name("uid").values("1").build())
        .build())
      .reference(SearchResultReference.builder().uris("ldap://directory-3.ldaptive.org").build())
      .build());
}