struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1431122 - /struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
Date Wed, 09 Jan 2013 22:35:08 GMT
Author: lukaszlenart
Date: Wed Jan  9 22:35:08 2013
New Revision: 1431122

URL: http://svn.apache.org/viewvc?rev=1431122&view=rev
Log:
WW-2923 adds support to be Locale independent

Modified:
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java?rev=1431122&r1=1431121&r2=1431122&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidatorTest.java
Wed Jan  9 22:35:08 2013
@@ -8,9 +8,12 @@ import com.opensymphony.xwork2.validator
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 
 public class DateRangeFieldValidatorTest extends XWorkTestCase {
 
+    private Locale copy;
+
     public void testPassValidation() throws Exception {
         // given
         ValidationAction action = prepareAction(createDate(2013, 6, 6));
@@ -35,7 +38,7 @@ public class DateRangeFieldValidatorTest
 
         // then
         assertTrue(context.getFieldErrors().size() == 1);
-        assertEquals("Max is 12/12/13, min is 1/1/13 but value is 3/3/12", context.getFieldErrors().get("dateRange").get(0));
+        assertEquals("Max is 12.12.13, min is 01.01.13 but value is 03.03.12", context.getFieldErrors().get("dateRange").get(0));
     }
 
     public void testMaxValidation() throws Exception {
@@ -49,7 +52,7 @@ public class DateRangeFieldValidatorTest
 
         // then
         assertTrue(context.getFieldErrors().size() == 1);
-        assertEquals("Max is 12/12/13, min is 1/1/13 but value is 4/4/14", context.getFieldErrors().get("dateRange").get(0));
+        assertEquals("Max is 12.12.13, min is 01.01.13 but value is 04.04.14", context.getFieldErrors().get("dateRange").get(0));
     }
 
     private ValidationAction prepareAction(Date range) {
@@ -83,4 +86,17 @@ public class DateRangeFieldValidatorTest
         return validator;
     }
 
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        copy = Locale.getDefault();
+        Locale.setDefault(new Locale("DE"));
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        Locale.setDefault(copy);
+    }
+
 }



Mime
View raw message