LdapEntry extends AbstractMessage { public void removeAttribute(final String name) { attributes.remove(name.toLowerCase()); } 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 removeAttribute() { final LdapAttribute attr1 = new LdapAttribute("givenName", "John"); final LdapAttribute attr2 = new LdapAttribute("sn", "Doe"); final Set<LdapAttribute> s = new HashSet<>(); s.add(attr1); final LdapEntry le = LdapEntry.builder().dn("uid=1").attributes(s).build(); le.addAttributes(attr2); le.removeAttribute("GIVENNAME"); Assert.assertEquals(le.size(), 1); le.clear(); Assert.assertEquals(le.size(), 0); }