diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java index f826fcaeba..549e129833 100644 --- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java +++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java @@ -1330,17 +1330,22 @@ private boolean removeObjectClassAttribute(Attribute attribute, Collection missingValues = new LinkedList<>(); + assertTrue(e.removeAttribute( + Attributes.create("objectClass", "organizationalPerson", "inetOrgPerson"), missingValues)); + + assertThat(missingValues).isEmpty(); + assertThat(e.getObjectClasses().values()).containsOnly("top", "person"); + } + + /** + * A delete of an object class value which the entry does not have must be reported as a missing + * value, whatever the other values of the same modification are. + */ + @Test + public void testRemoveObjectClassValuesOneOfWhichIsMissing() throws Exception + { + Entry e = newTestUserEntry(); + + List missingValues = new LinkedList<>(); + assertFalse(e.removeAttribute( + Attributes.create("objectClass", "inetOrgPerson", "domain"), missingValues)); + + assertThat(missingValues).containsOnly(ByteString.valueOfUtf8("domain")); + assertThat(e.getObjectClasses().values()).containsOnly("top", "person", "organizationalPerson"); + } + /** * Test the {@link Entry#parseAttribute(String)} method. */