RegexTargetResolver r = new RegexTargetResolver();
r.setPattern("/test", TargetType.TYPE_SERVICE);
r.setPattern("/test/([^/?#]+)", TargetType.TYPE_COLLECTION);
DummyRequestContext drc = null;
Target target = null;
drc = new DummyRequestContext("/test","http://example.org/");
target = r.resolve(drc);
assertNotNull(target);
assertEquals(target.getType(), TargetType.TYPE_SERVICE);
drc = new DummyRequestContext("/test/foo","http://example.org/");
target = r.resolve(drc);
assertNotNull(target);
assertEquals(target.getType(), TargetType.TYPE_COLLECTION);
drc = new DummyRequestContext("/test/foo/","http://example.org/");
target = r.resolve(drc);
assertNull(target);