[ grinder-Bugs-1619450 ] test HTTPClient.TestCookie.testParse fails

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #1619450, was opened at 2006-12-20 14:01
Message generated for change (Comment added) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=1619450&group_id=18598

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
Resolution: Fixed
Priority: 3
Private: No
Submitted By: Bastiaan Bakker (bastiaan)
Assigned to: Philip Aston (philipa)
Summary: test HTTPClient.TestCookie.testParse fails

Initial Comment:
test HTTPClient.TestCookie.testParse fails:

test:
    [junit] Testsuite: HTTPClient.TestCookie
    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.229 sec

    [junit] Testcase: testParse took 0.225 sec
    [junit]     FAILED
    [junit] expected:<Sat Mar 25 1[6:53:28 GM]T 2006> but was:<Sat Mar 25 1[7:53:28 CE]T 2006>
    [junit] junit.framework.ComparisonFailure: expected:<Sat Mar 25 1[6:53:28 GM]T 2006> but was:<Sat Mar 25 1[7:53:28 CE]T 2006>
    [junit]     at HTTPClient.TestCookie.testParse(TestCookie.java:69)

The test should explicitly convert the expire Data to a GMT timezone String or compare Date objects rather than Strings.
 

----------------------------------------------------------------------

>Comment By: Philip Aston (philipa)
Date: 2009-12-20 11:43

Message:
Thanks for the fix. Now applied:
http://grinder.svn.sourceforge.net/viewvc/grinder?view=rev&revision=4202

----------------------------------------------------------------------

Comment By: amachang (amachang)
Date: 2009-12-15 02:06

Message:
This problem seems not to be fixed yet in trunk.

*Ant Result
test:
    [junit] Testsuite: HTTPClient.TestCookie
    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.45 sec
    [junit] 
    [junit] Testcase: testParse took 0.414 sec
    [junit]     FAILED
    [junit] expected:<Sat Mar 25 16:53:28 JST 2006> but was:<Sun Mar 26
01:53:28 JST 2006>
    [junit] junit.framework.AssertionFailedError: expected:<Sat Mar 25
16:53:28 JST 2006> but was:<Sun Mar 26 01:53:28 JST 2006>
    [junit]     at HTTPClient.TestCookie.testParse(TestCookie.java:76)
    [junit] 

*What is Problem?
// Time zone offset is considered in the following:
    final Cookie[] cookies2 =
      Cookie.parse("foo=bah;path=lah;expires=Sat, Mar 25 16:53:28 GMT
2006", m_roRequest);

// But, time zone offset is not considered in the following:
    final Date result = df.parse("25/03/06 16:53:28");

// So, this parse result changes by the user's locale.
// And the test fails.

*What Should You Do?
Set java.util.TimeZone object to java.text.DateFormat object.

*Patch
http://amachang.sakura.ne.jp/misc/patches/grinder-cookie-test.diff

----------------------------------------------------------------------

Comment By: Philip Aston (philipa)
Date: 2007-02-24 11:54

Message:
Logged In: YES 
user_id=2117
Originator: NO

Fixed for beta 33.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=1619450&group_id=18598

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.