Added test to UrlBuilderTest for utf8 VIVO-168
This commit is contained in:
parent
8d78ba0373
commit
926d154bce
1 changed files with 18 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||||
|
@ -58,4 +59,21 @@ public class UrlBuilderTest extends AbstractTestClass {
|
||||||
Assert.assertEquals(vClassUri, UrlBuilder.urlDecode(vClassUriEncoded));
|
Assert.assertEquals(vClassUri, UrlBuilder.urlDecode(vClassUriEncoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUtf8Encode(){
|
||||||
|
UrlBuilder.contextPath = "/vivo";
|
||||||
|
String path = "/individual";
|
||||||
|
ParamMap params = new ParamMap();
|
||||||
|
params.put("name", "★Tom★");
|
||||||
|
Assert.assertEquals("/vivo/individual?name=%E2%98%85Tom%E2%98%85", UrlBuilder.getUrl(path, params));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDecodeUtf8Url() {
|
||||||
|
String vClassUri = "http://vivoweb.org/ontology/core#FacultyMember★";
|
||||||
|
String vClassUriEncoded = "http%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23FacultyMember%E2%98%85";
|
||||||
|
Assert.assertEquals(vClassUri, UrlBuilder.urlDecode(vClassUriEncoded));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue