tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Christensen (JIRA)" <tapestry-...@jakarta.apache.org>
Subject [jira] Commented: (TAPESTRY-1223) Integration tests in tapestry-core fails because of differences in date formats (locale)
Date Thu, 04 Jan 2007 16:47:27 GMT

    [ https://issues.apache.org/jira/browse/TAPESTRY-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462250
] 

Thomas Christensen commented on TAPESTRY-1223:
----------------------------------------------

The following patch makes the test case use the locales date formatting. Apply with patch
-p < file in tapestry-core/trunk/

Sorry. Could not attach to Jira for some reason.

----------------------cut------------------------
Index: src/test/java/org/apache/tapestry/integration/IntegrationTests.java
===================================================================
--- src/test/java/org/apache/tapestry/integration/IntegrationTests.java (revision 492604)
+++ src/test/java/org/apache/tapestry/integration/IntegrationTests.java (working copy)
@@ -16,6 +16,11 @@
 
 import static java.lang.String.format;
 
+import java.sql.Date;
+import java.text.DateFormat;
+import java.text.Format;
+import java.util.Calendar;
+
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -252,23 +257,25 @@
     {
         _selenium.open(BASE_URL);
 
-        final String[] dates =
-        { "Jun 13, 1999", "Jul 15, 2001", "Dec 4, 2005" };
+        Format _format = DateFormat.getDateInstance(DateFormat.MEDIUM);
+        
+        final Date[] dates =
+        { new Date(99, Calendar.JUNE, 13), new Date(101, Calendar.JULY, 15), new Date(105,
Calendar.DECEMBER, 4) };
 
         clickAndWait("link=InstanceMixin");
 
-        for (String date : dates)
+        for (Date date : dates)
         {
-            String snippet = String.format("[%s]", date);
+            String snippet = String.format("[%s]", _format.format(date));
 
             assertSourcePresent(snippet);
         }
 
         clickAndWait("link=Toggle emphasis");
 
-        for (String date : dates)
+        for (Date date : dates)
         {
-            String snippet = String.format("[<em>%s</em>]", date);
+            String snippet = String.format("[<em>%s</em>]", _format.format(date));
             assertSourcePresent(snippet);
         }
     }
-----------------------cut---------------------

> Integration tests in tapestry-core fails because of differences in date formats (locale)
> ----------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1223
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1223
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 5.0
>         Environment: Mac OSX, Danish locale, Tapestry v5.0 snapshot 3rd of Jan 2007
>            Reporter: Thomas Christensen
>            Priority: Trivial
>             Fix For: 5.0
>
>
> The integration tests fails with the following message:
> -------------------------------------------------------------------------------
> Test set: Tapestry Core
> -------------------------------------------------------------------------------
> Tests run: 501, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 89.77 sec <<<
FAILURE!
> org.apache.tapestry.integration.IntegrationTests.instance_mixin(org.apache.tapestry.integration.IntegrationTests.instance_mixin)
 Time elapsed: 1.19 sec  <<< FAILURE!
> java.lang.AssertionError: Page did not contain source '[Ljava.lang.String;@9cf2df'.
> 	at org.apache.tapestry.integration.IntegrationTests.assertSourcePresent(IntegrationTests.java:517)
> 	at org.apache.tapestry.integration.IntegrationTests.instance_mixin(IntegrationTests.java:264)
> This seems to be due to hardcoded US formattede dates in the test case in question. Comparing
these to dates formatted according to the JVM's or the HTTP sessions locale ends up failing
the test.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message