fixed failing test case

git-svn-id: https://svn.apache.org/repos/asf/incubator/webwork2@396245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Toby Jee
2006-04-23 09:43:49 +00:00
parent 4926dbaad3
commit e18af841f9
@@ -282,16 +282,30 @@ public class UrlHelperTest extends StrutsTestCase {
}
public void testTranslateAndEncode() throws Exception {
String result = UrlHelper.translateAndEncode("\u65b0\u805e");
String expectedResult = "%E6%96%B0%E8%81%9E";
Object defaultI18nEncoding = Configuration.get(StrutsConstants.STRUTS_I18N_ENCODING);
try {
Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8");
String result = UrlHelper.translateAndEncode("\u65b0\u805e");
String expectedResult = "%E6%96%B0%E8%81%9E";
assertEquals(result, expectedResult);
assertEquals(result, expectedResult);
}
finally {
Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding);
}
}
public void testTranslateAndDecode() throws Exception {
String result = UrlHelper.translateAndDecode("%E6%96%B0%E8%81%9E");
String expectedResult = "\u65b0\u805e";
Object defaultI18nEncoding = Configuration.get(StrutsConstants.STRUTS_I18N_ENCODING);
try {
Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8");
String result = UrlHelper.translateAndDecode("%E6%96%B0%E8%81%9E");
String expectedResult = "\u65b0\u805e";
assertEquals(result, expectedResult);
assertEquals(result, expectedResult);
}
finally {
Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding);
}
}
}