DITContentRule extends AbstractNamedSchemaElement { public static DITContentRule parse(final String definition) throws ParseException { final Matcher m = DEFINITION_PATTERN.matcher(definition); if (!m.matches()) { throw new ParseException("Invalid DIT content rule definition: " + definition, definition.length()); } final DITContentRule dcrd = new DITContentRule(m.group(1).trim()); if (m.group(2) != null) { dcrd.setNames(SchemaUtils.parseDescriptors(m.group(2).trim())); } else if (m.group(3) != null) { dcrd.setNames(SchemaUtils.parseDescriptors(m.group(3).trim())); } dcrd.setDescription(m.group(4) != null ? m.group(4).trim() : null); dcrd.setObsolete(m.group(5) != null); if (m.group(6) != null) { dcrd.setAuxiliaryClasses(SchemaUtils.parseOIDs(m.group(6).trim())); } else if (m.group(7) != null) { dcrd.setAuxiliaryClasses(SchemaUtils.parseOIDs(m.group(7).trim())); } if (m.group(9) != null) { dcrd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(9).trim())); } else if (m.group(10) != null) { dcrd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(10).trim())); } if (m.group(11) != null) { dcrd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(11).trim())); } else if (m.group(12) != null) { dcrd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(12).trim())); } if (m.group(11) != null) { dcrd.setRestrictedAttributes(SchemaUtils.parseOIDs(m.group(11).trim())); } else if (m.group(12) != null) { dcrd.setRestrictedAttributes(SchemaUtils.parseOIDs(m.group(12).trim())); } if (m.group(13) != null) { dcrd.setExtensions(Extensions.parse(m.group(13).trim())); } return dcrd; } DITContentRule(final String s);  DITContentRule(
    final String oid,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String[] auxiliaryClasses,
    final String[] requiredAttributes,
    final String[] optionalAttributes,
    final String[] restrictedAttributes,
    final Extensions extensions); String getOID(); String[] getAuxiliaryClasses(); void setAuxiliaryClasses(final String[] s); String[] getRequiredAttributes(); void setRequiredAttributes(final String[] s); String[] getOptionalAttributes(); void setOptionalAttributes(final String[] s); String[] getRestrictedAttributes(); void setRestrictedAttributes(final String[] s); static DITContentRule 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 DITContentRule contentRule, final String definition) throws Exception { final DITContentRule parsed = DITContentRule.parse(definition); Assert.assertEquals(contentRule, parsed); Assert.assertEquals(definition, parsed.format()); Assert.assertEquals(contentRule.format(), parsed.format()); }