+ " not successful, but it should be.", parsed1 >= 0);
assertEquals(encodedToken, variables1.get("token"));
}
public void testPathMatching() {
Template template = new Template("http://www.mydomain.com/abc/{v1}");
template.setMatchingMode(Template.MODE_STARTS_WITH);
template.getDefaultVariable().setType(Variable.TYPE_URI_PATH);
Map<String, Object> variables1 = new HashMap<String, Object>();
String string1 = "http://www.mydomain.com/abc/123/456";
int parsed1 = template.parse(string1, variables1);
assertTrue("parsing of " + string1
+ " not successful, but it should be.", parsed1 >= 0);
assertEquals("123/456", variables1.get("v1"));
Map<String, Object> variables2 = new HashMap<String, Object>();
String string2 = "http://www.mydomain.com/abc/123/456?s=tuv";
int parsed2 = template.parse(string2, variables2);
assertTrue("parsing of " + string2
+ " not successful, but it should be.", parsed2 >= 0);
assertEquals("123/456", variables2.get("v1"));
Map<String, Object> variables3 = new HashMap<String, Object>();
String string3 = "http://www.mydomain.com/abc/123/456#tuv";
int parsed3 = template.parse(string3, variables3);
assertTrue("parsing of " + string3
+ " not successful, but it should be.", parsed3 >= 0);
assertEquals("123/456", variables3.get("v1"));
}