@Test
public void testMatches() {

    assertMatch("x", "x");
    assertNoMatch("x", "y");
    assertMatch("xx", "xx");
    assertNoMatch("xy", "xz");
    assertMatch("?", "x");
    assertMatch("x?", "xy");
    assertMatch("?y", "xy");
    assertMatch("x?z", "xyz");
    assertMatch("*", "x");
    assertMatch("x*", "x");
    assertMatch("x*", "xy");
    assertMatch("xy*", "xy");
    assertMatch("xy*", "xyz");
    assertMatch("*x", "x");
    assertNoMatch("*x", "y");
    assertMatch("*x", "wx");
    assertNoMatch("*x", "wz");
    assertMatch("*x", "vwx");
    assertMatch("x*z", "xz");
    assertMatch("x*z", "xyz");
    assertMatch("x*z", "xyyz");
    assertNoMatch("ab*t?z", "abz");
    assertNoMatch("ab*d*yz", "abcdz");
    assertMatch("ab**cd**ef*yz", "abcdefyz");
    assertMatch("a*c?*z", "abcxyz");
    assertMatch("a*cd*z", "abcdxyz");
    assertMatch("*", "x:x");
    assertMatch("*", "x:x:x");
    assertMatch("x", "x:y");
    assertMatch("x", "x:y:z");
    assertMatch("foo?armat*", "foobarmatches");
    assertMatch("f*", "f");
    assertNoMatch("foo", "f");
    assertMatch("fo*b", "foob");
    assertNoMatch("fo*b*r", "fooba");
    assertNoMatch("foo*", "f");
    assertMatch("t*k?ou", "thankyou");
    assertMatch("he*l*world", "helloworld");
    assertNoMatch("foo", "foob");
    assertMatch("*:ActiveMQ.Advisory", "foo:ActiveMQ.Advisory");
    assertNoMatch("*:ActiveMQ.Advisory", "foo:ActiveMQ.Advisory.");
    assertMatch("*:ActiveMQ.Advisory*", "foo:ActiveMQ.Advisory");
    assertMatch("*:ActiveMQ.Advisory*", "foo:ActiveMQ.Advisory.");
    assertMatch("*:ActiveMQ.Advisory.*", "foo:ActiveMQ.Advisory.Connection");
    assertMatch("*:ActiveMQ.Advisory*:read", "foo:ActiveMQ.Advisory.Connection:read");
    assertNoMatch("*:ActiveMQ.Advisory*:read", "foo:ActiveMQ.Advisory.Connection:write");
    assertMatch("*:ActiveMQ.Advisory*:*", "foo:ActiveMQ.Advisory.Connection:read");
    assertMatch("*:ActiveMQ.Advisory*:*", "foo:ActiveMQ.Advisory.");
    assertMatch("topic", "topic:TEST:*");
    assertNoMatch("*:ActiveMQ*", "topic:TEST:*");
    assertMatch("topic:ActiveMQ.Advisory*", "topic:ActiveMQ.Advisory.Connection:create");
    assertMatch("foo?ar", "foobar");
}