String[][] suffix2 = {{"suffix", "enc%3Aoded", "enc%3Aoded"}};
assertMatchTemplate(templateSuffix, "/suffix/enc%3Aoded/enc%3Aoded/", suffix2);
}
public void testEncodedSubstitutedValues() {
UriTemplateProcessor templateVar = new BitWorkingUriTemplateProcessor("/var/{var}");
HashMap<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("var", "enc:oded");
assertEquals("values encoded", "/var/enc%3Aoded", templateVar.expand(hashMap));
UriTemplateProcessor templateJoin =
new BitWorkingUriTemplateProcessor("/join/{-join|;|join}");
hashMap = new HashMap<String, Object>();
hashMap.put("join", "enc:oded");
assertEquals("values encoded", "/join/join=enc%3Aoded", templateJoin.expand(hashMap));
UriTemplateProcessor templateList =
new BitWorkingUriTemplateProcessor("/list/{-list|/|list}");
hashMap = new HashMap<String, Object>();
hashMap.put("list", new String[] {"enc:oded"});
assertEquals("values encoded", "/list/enc%3Aoded", templateList.expand(hashMap));
hashMap = new HashMap<String, Object>();
hashMap.put("list", new String[] {"enc:oded", "enc:oded"});
assertEquals("values encoded", "/list/enc%3Aoded/enc%3Aoded", templateList.expand(hashMap));
UriTemplateProcessor templatePrefix =
new BitWorkingUriTemplateProcessor("/prefix{-prefix|/|prefix}");
hashMap = new HashMap<String, Object>();
hashMap.put("prefix", "enc:oded");
assertEquals("values encoded", "/prefix/enc%3Aoded", templatePrefix.expand(hashMap));
hashMap = new HashMap<String, Object>();
hashMap.put("prefix", new String[] {"enc:oded", "enc:oded"});
assertEquals("values encoded", "/prefix/enc%3Aoded/enc%3Aoded", templatePrefix
.expand(hashMap));
UriTemplateProcessor templateSuffix =
new BitWorkingUriTemplateProcessor("/suffix/{-suffix|/|suffix}");
hashMap = new HashMap<String, Object>();
hashMap.put("suffix", "enc:oded");
assertEquals("values encoded", "/suffix/enc%3Aoded/", templateSuffix.expand(hashMap));
hashMap = new HashMap<String, Object>();
hashMap.put("suffix", new String[] {"enc:oded", "enc:oded"});
assertEquals("values encoded", "/suffix/enc%3Aoded/enc%3Aoded/", templateSuffix
.expand(hashMap));
}