From e18af841f9aac9bd802cb6876c09bbdaa23411ee Mon Sep 17 00:00:00 2001 From: Toby Jee Date: Sun, 23 Apr 2006 09:43:49 +0000 Subject: [PATCH] fixed failing test case git-svn-id: https://svn.apache.org/repos/asf/incubator/webwork2@396245 13f79535-47bb-0310-9956-ffa450edef68 --- .../action2/views/util/UrlHelperTest.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/action/src/test/java/org/apache/struts/action2/views/util/UrlHelperTest.java b/action/src/test/java/org/apache/struts/action2/views/util/UrlHelperTest.java index 7039878a8..1c0151b18 100644 --- a/action/src/test/java/org/apache/struts/action2/views/util/UrlHelperTest.java +++ b/action/src/test/java/org/apache/struts/action2/views/util/UrlHelperTest.java @@ -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); + } } }