DITStructureRule extends AbstractNamedSchemaElement { public static DITStructureRule parse(final String definition) throws ParseException { final Matcher m = DEFINITION_PATTERN.matcher(definition); if (!m.matches()) { throw new ParseException("Invalid DIT structure rule definition: " + definition, definition.length()); } final DITStructureRule dsrd = new DITStructureRule(Integer.parseInt(m.group(1).trim())); if (m.group(2) != null) { dsrd.setNames(SchemaUtils.parseDescriptors(m.group(2).trim())); } else if (m.group(3) != null) { dsrd.setNames(SchemaUtils.parseDescriptors(m.group(3).trim())); } dsrd.setDescription(m.group(4) != null ? m.group(4).trim() : null); dsrd.setObsolete(m.group(5) != null); dsrd.setNameForm(m.group(6) != null ? m.group(6).trim() : null); if (m.group(7) != null) { dsrd.setSuperiorRules(SchemaUtils.parseNumbers(m.group(7).trim())); } else if (m.group(8) != null) { dsrd.setSuperiorRules(SchemaUtils.parseNumbers(m.group(8).trim())); } if (m.group(9) != null) { dsrd.setExtensions(Extensions.parse(m.group(9).trim())); } return dsrd; } DITStructureRule(final int i);  DITStructureRule(
    final int id,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String nameForm,
    final int[] superiorRules,
    final Extensions extensions); int getID(); String getNameForm(); void setNameForm(final String s); int[] getSuperiorRules(); void setSuperiorRules(final int[] i); static DITStructureRule 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 DITStructureRule structureRule, final String definition) throws Exception { final DITStructureRule parsed = DITStructureRule.parse(definition); Assert.assertEquals(structureRule, parsed); Assert.assertEquals(definition, parsed.format()); Assert.assertEquals(structureRule.format(), parsed.format()); }