### Question:
ObjectClass extends CommonSchemaElements { public Set<AttributeType> getRequiredAttributes() { return requiredAttributes; } ObjectClass(String definition, String primaryName,
                     Collection<String> names, String oid,
                     String description,
                     Set<ObjectClass> superiorClasses,
                     Set<AttributeType> requiredAttributes,
                     Set<AttributeType> optionalAttributes,
                     ObjectClassType objectClassType,
                     boolean isObsolete,
                     Map<String, List<String>> extraProperties); Set<ObjectClass> getSuperiorClasses(); boolean isDescendantOf(ObjectClass objectClass); Set<AttributeType> getRequiredAttributes(); Set<AttributeType> getRequiredAttributeChain(); boolean isRequired(AttributeType attributeType); Set<AttributeType> getOptionalAttributes(); Set<AttributeType> getOptionalAttributeChain(); boolean isOptional(AttributeType attributeType); boolean isRequiredOrOptional(AttributeType attributeType); ObjectClassType getObjectClassType(); boolean isExtensibleObject(); @Override String toString(); ObjectClass setDirty(); boolean isDirty();  }### Answer:
@Test public void testGetRequiredAttributesNoSuperiorEmpty() throws Exception { ObjectClassBuilder builder = new ObjectClassBuilder("testType", "1.2.3"); ObjectClass c = builder.getInstance(); Assert.assertTrue(c.getRequiredAttributes().isEmpty()); }
@Test public void testGetRequiredAttributesNoSuperior() throws Exception { ObjectClassBuilder builder = new ObjectClassBuilder("testType", "1.2.3"); builder.addRequiredAttributeTypes(types[0], types[1], types[2]); ObjectClass c = builder.getInstance(); Set<AttributeType> chain = c.getRequiredAttributes(); Assert.assertEquals(chain.size(), 3); Assert.assertTrue(chain.contains(types[0])); Assert.assertTrue(chain.contains(types[1])); Assert.assertTrue(chain.contains(types[2])); }
@Test public void testGetRequiredAttributesEmpty() throws Exception { ObjectClassBuilder builder = new ObjectClassBuilder("parent", "1.2.3"); builder.addRequiredAttributeTypes(types[0], types[1], types[2]); ObjectClass parent = builder.getInstance(); builder = new ObjectClassBuilder("child", "1.2.3"); builder.setSuperior(Collections.singleton(parent)); ObjectClass child = builder.getInstance(); Assert.assertTrue(child.getRequiredAttributes().isEmpty()); }
@Test public void testGetRequiredAttributes() throws Exception { ObjectClassBuilder builder = new ObjectClassBuilder("parent", "1.2.3"); builder.addRequiredAttributeTypes(types[0], types[1], types[2]); ObjectClass parent = builder.getInstance(); builder = new ObjectClassBuilder("child", "1.2.3"); builder.addRequiredAttributeTypes(types[3], types[4], types[5]); builder.setSuperior(Collections.singleton(parent)); ObjectClass child = builder.getInstance(); Set<AttributeType> chain = child.getRequiredAttributes(); Assert.assertEquals(chain.size(), 3); Assert.assertTrue(chain.contains(types[3])); Assert.assertTrue(chain.contains(types[4])); Assert.assertTrue(chain.contains(types[5])); }