MatchingRule extends AbstractNamedSchemaElement { public static MatchingRule parse(final String definition) throws ParseException { final Matcher m = DEFINITION_PATTERN.matcher(definition); if (!m.matches()) { throw new ParseException("Invalid matching rule definition: " + definition, definition.length()); } final MatchingRule mrd = new MatchingRule(m.group(1).trim()); if (m.group(2) != null) { mrd.setNames(SchemaUtils.parseDescriptors(m.group(2).trim())); } else if (m.group(3) != null) { mrd.setNames(SchemaUtils.parseDescriptors(m.group(3).trim())); } mrd.setDescription(m.group(4) != null ? m.group(4).trim() : null); mrd.setObsolete(m.group(5) != null); mrd.setSyntaxOID(m.group(6) != null ? m.group(6).trim() : null); if (m.group(7) != null) { mrd.setExtensions(Extensions.parse(m.group(7).trim())); } return mrd; } MatchingRule(final String s);  MatchingRule(
    final String oid,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String syntaxOID,
    final Extensions extensions); String getOID(); String getSyntaxOID(); void setSyntaxOID(final String s); static MatchingRule 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 MatchingRule matchingRule, final String definition) throws Exception { final MatchingRule parsed = MatchingRule.parse(definition); Assert.assertEquals(matchingRule, parsed); Assert.assertEquals(definition, parsed.format()); Assert.assertEquals(matchingRule.format(), parsed.format()); }