You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by tm...@apache.org on 2006/08/06 18:06:09 UTC
svn commit: r429146 -
/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
Author: tmjee
Date: Sun Aug 6 09:06:08 2006
New Revision: 429146
URL: http://svn.apache.org/viewvc?rev=429146&view=rev
Log:
WW-1340
- added more test case for Dispatcher
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java?rev=429146&r1=429145&r2=429146&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java Sun Aug 6 09:06:08 2006
@@ -19,8 +19,16 @@
import java.util.Locale;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.struts2.StrutsTestCase;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.config.Settings;
+import org.apache.struts2.dispatcher.Dispatcher;
import com.opensymphony.xwork2.util.LocalizedTextUtil;
/**
@@ -44,4 +52,30 @@
"Error uploading: some error messages");
}
+ public void testPrepareSetEncodingProperly() throws Exception {
+ HttpServletRequest req = new MockHttpServletRequest();
+ HttpServletResponse res = new MockHttpServletResponse();
+
+ Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
+
+
+ Dispatcher du = Dispatcher.getInstance();
+ du.prepare(req, res);
+
+ assertEquals(req.getCharacterEncoding(), "utf-8");
+ }
+
+ public void testPrepareSetEncodingPropertyWithMultipartRequest() throws Exception {
+ MockHttpServletRequest req = new MockHttpServletRequest();
+ MockHttpServletResponse res = new MockHttpServletResponse();
+
+ req.setContentType("multipart/form-data");
+ Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
+
+
+ Dispatcher du = Dispatcher.getInstance();
+ du.prepare(req, res);
+
+ assertEquals(req.getCharacterEncoding(), "utf-8");
+ }
}