LdapEntry extends AbstractMessage { @Override public boolean equals(final Object o) { if (o == this) { return true; } if (o instanceof LdapEntry && super.equals(o)) { final LdapEntry v = (LdapEntry) o; return LdapUtils.areEqual( ldapDn != null ? ldapDn.toLowerCase() : null, v.ldapDn != null ? v.ldapDn.toLowerCase() : null) && LdapUtils.areEqual(attributes, v.attributes); } return false; } LdapEntry();  LdapEntry(final DERBuffer buffer); String getDn(); void setDn(final String dn); Collection<LdapAttribute> getAttributes(); LdapAttribute getAttribute(); LdapAttribute getAttribute(final String name); String[] getAttributeNames(); void addAttributes(final LdapAttribute... attrs); void addAttributes(final Collection<LdapAttribute> attrs); void removeAttribute(final String name); void removeAttributes(final LdapAttribute... attrs); void removeAttributes(final Collection<LdapAttribute> attrs); int size(); void clear(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static LdapEntry sort(final LdapEntry le); static AttributeModification[] computeModifications(final LdapEntry source, final LdapEntry target); static Builder builder(); static final int PROTOCOL_OP; }
@Test public void testEquals() { final LdapEntry le1 = LdapEntry.builder().build(); Assert.assertEquals(le1, le1); Assert.assertEquals(LdapEntry.builder().build(), LdapEntry.builder().build()); Assert.assertEquals( LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("1").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build(), LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("1").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build()); Assert.assertNotEquals( LdapEntry.builder() .dn("uid=2,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("1").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build(), LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("1").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build()); Assert.assertNotEquals( LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("2").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build(), LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes( LdapAttribute.builder().name("uid").values("1").build(), LdapAttribute.builder().name("givenName").values("Steve").build(), LdapAttribute.builder().name("sn").values("McQueen").build()) .build()); }