ObjectClass extends AbstractNamedSchemaElement { public static ObjectClass parse(final String definition) throws ParseException { final Matcher m = DEFINITION_PATTERN.matcher(definition); if (!m.matches()) { throw new ParseException("Invalid object class definition: " + definition, definition.length()); } final ObjectClass ocd = new ObjectClass(m.group(1).trim()); if (m.group(2) != null) { ocd.setNames(SchemaUtils.parseDescriptors(m.group(2).trim())); } else if (m.group(3) != null) { ocd.setNames(SchemaUtils.parseDescriptors(m.group(3).trim())); } ocd.setDescription(m.group(4) != null ? m.group(4).trim() : null); ocd.setObsolete(m.group(5) != null); if (m.group(6) != null) { ocd.setSuperiorClasses(SchemaUtils.parseOIDs(m.group(6).trim())); } else if (m.group(7) != null) { ocd.setSuperiorClasses(SchemaUtils.parseOIDs(m.group(7).trim())); } if (m.group(8) != null) { ocd.setObjectClassType(ObjectClassType.valueOf(m.group(8).trim())); } if (m.group(9) != null) { ocd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(9).trim())); } else if (m.group(10) != null) { ocd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(10).trim())); } if (m.group(11) != null) { ocd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(11).trim())); } else if (m.group(12) != null) { ocd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(12).trim())); } if (m.group(13) != null) { ocd.setExtensions(Extensions.parse(m.group(13).trim())); } return ocd; } ObjectClass(final String s);  ObjectClass(
    final String oid,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String[] superiorClasses,
    final ObjectClassType objectClassType,
    final String[] requiredAttributes,
    final String[] optionalAttributes,
    final Extensions extensions); String getOID(); String[] getSuperiorClasses(); void setSuperiorClasses(final String[] s); ObjectClassType getObjectClassType(); void setObjectClassType(final ObjectClassType type); String[] getRequiredAttributes(); void setRequiredAttributes(final String[] s); String[] getOptionalAttributes(); void setOptionalAttributes(final String[] s); static ObjectClass parse(final String definition); @Override String format(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(groups = "schema", dataProvider = "definitions") public void parse(final ObjectClass objectClass, final String definition) throws Exception { final ObjectClass parsed = ObjectClass.parse(definition); Assert.assertEquals(objectClass, parsed); Assert.assertEquals(definition, parsed.format()); Assert.assertEquals(objectClass.format(), parsed.format()); }