*/
public class AttributedQNameTest extends Assert {
@Test
public void testMatches() {
AttributedQName aqname = new AttributedQName("urn:foo", "petra");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertFalse(aqname.matches(new QName("urn:bar", "petra")));
assertFalse(aqname.matches(new QName("urn:foo", "petira")));
aqname = new AttributedQName("urn:foo", "*tra");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertTrue(aqname.matches(new QName("urn:foo", "astra")));
assertFalse(aqname.matches(new QName("urn:foo", "sandra")));
aqname = new AttributedQName("urn:foo", "pe*");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertFalse(aqname.matches(new QName("urn:foo", "astra")));
assertTrue(aqname.matches(new QName("urn:foo", "peach")));
assertTrue(aqname.matches(new QName("urn:foo", "peteria")));
aqname = new AttributedQName("urn:foo", "p*t*a");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertFalse(aqname.matches(new QName("urn:foo", "astra")));
assertFalse(aqname.matches(new QName("urn:foo", "pesandra")));
assertTrue(aqname.matches(new QName("urn:foo", "patricia")));
aqname = new AttributedQName("urn:foo", "p?t?a");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertTrue(aqname.matches(new QName("urn:foo", "patia")));
assertFalse(aqname.matches(new QName("urn:foo", "patricia")));
aqname = new AttributedQName("urn:foo", "de.petra");
assertTrue(aqname.matches(new QName("urn:foo", "de.petra")));
aqname = new AttributedQName("urn:foo", "de.pe*");
assertTrue(aqname.matches(new QName("urn:foo", "de.petra")));
assertTrue(aqname.matches(new QName("urn:foo", "de.peach")));
assertFalse(aqname.matches(new QName("urn:foo", "delpeach")));
// matches any namespaces qualified and unqualified
aqname = new AttributedQName("*", "p*a");
assertTrue(aqname.matches(new QName("urn:foo", "petra")));
assertTrue(aqname.matches(new QName("urn:bar", "patia")));
assertTrue(aqname.matches(new QName("", "patricia")));
assertFalse(aqname.matches(new QName("urn:bar", "peach")));
}