lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: GData tests
Date Sun, 23 Sep 2007 01:58:51 GMT
Here's the error I get when running on zones:

  Testcase: testFormatDate 
(org.apache.lucene.gdata.utils.TestDateFormater):   FAILED
     [junit] Sun, 23 Sep 2007 01:29:06 GMT+00:00 does not match  
expected pattern
     [junit] junit.framework.AssertionFailedError: Sun, 23 Sep 2007  
01:29:06 GMT+00:00 does not match expected pattern
     [junit]     at  
org.apache.lucene.gdata.utils.TestDateFormater.testFormatDate 
(TestDateFormater.java:41)

And here's the pattern:
"[A-Z][a-z]{1,2}, [0-9]{1,2} [A-Z][a-z]{2} [0-9]{4} [0-9]{1,2}:[0-9] 
{1,2}:[0-9]{1,2} [A-Z]{2,4}"

The problem is the +00:00 at the end.  My guess is that last part  
should be optional.

I will open a bug.

-Grant

On Sep 20, 2007, at 2:53 PM, Chris Hostetter wrote:

> :             java.util.regex.Pattern pattern =   
> java.util.regex.Pattern.compile("[A-Z][a-z]{1,2}, [0-9]{1,2} [A-Z] 
> [a-z]{2} [0-9]{4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [A-Z]{2,4}");
> :             Date date = new Date();
> :             String formatedDate = DateFormater.formatDate 
> (date,DateFormater.HTTP_HEADER_DATE_FORMAT);
> :             assertTrue(pattern.matcher(formatedDate).matches 
> ());   // THIS ASSERT FAILS
>
> it doesn't fail for me, but it does look very TimeZone sensitive, the
> pattern the formatedDate is tested against doesn't look like it  
> would be
> too freindly to non-US timezones.
>
> a simple start is to get the test to be more verbose on failure ...  
> i just
> tweaked the asert to tell you exactly what string didn't match the  
> pattern
> if it fails  (hmm.. someone else just made it write the date to  
> stdout ..
> now we'll know twice!)
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>



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


Mime
View raw message