|
From: <jue...@we...> - 2003-11-12 08:21:06
|
I've repeatedly tried to fix that FormatHelperTests.testDataTimeElement = method, and there always seems to be some installation where it fails. = It has definitely something to do with the current machine's locale, but = it's hard to figure out why the machine's locale is used in the first = place - the test case feeds Locale.UK into = FormatHelper.dateTimeElement... =20 Does anyone mind if I just uncomment that test method? It gets on my = nerves, it really does - I've got more important stuff to worry about = ;-) Of course, if someone else wants to look at it, have a try... Darren = maybe? =20 Juergen ________________________________ Von: SourceForge.net [mailto:no...@so...] Gesendet: Mi 12.11.2003 07:58 An: no...@so... Betreff: [ springframework-Bugs-840442 ] [junit] testDateTimeElement = does not pass!!! Bugs item #840442, was opened at 2003-11-11 18:36 Message generated for change (Comment added) made by pombredanne You can respond by visiting: https://sourceforge.net/tracker/?func=3Ddetail&atid=3D537539&aid=3D840442= &group_id=3D73357 >Category: Web MVC - general Group: None Status: Open Resolution: None >Priority: 7 Submitted By: Philippe Ombredanne (pombredanne) >Assigned to: Juergen Hoeller (jhoeller) >Summary: [junit] testDateTimeElement does not pass!!! Initial Comment: A fresh checked out CVS copy of spring fails to pass the test : org.springframework.web.servlet.view.xslt.FormatHelperTests testDateTimeElement Interestingely enough I am in the US using a US locale, when the test is referring to a UK locale..... The following asserts do not pass because : "day-of-week"=3D"Tuesday" not Wednesday "day-of-month"=3D23 not 24 el =3D (Element) e.getElementsByTagName("day-of-week").item(0); assertTrue( "Wednesday".equals(el.getFirstChild().getNodeValue() )); el =3D (Element) e.getElementsByTagName("day-of-month").item(0); assertTrue( "24".equals(el.getFirstChild().getNodeValue() )); I have no idea on how to provide a resolution. I leave to you . Please note that the last check-in you made was about that very same test (see version 1.5 change log) "mysteriously fails on some installation" On mine, hours=3D"3", not 12.... BTW, it is not very explicit to use assertTrue for strings, when assertEquals is much more explicit, and assertEquals with a description is always preferred. Philippe O. ---------------------------------------------------------------------- >Comment By: Philippe Ombredanne (pombredanne) Date: 2003-11-11 22:58 Message: Logged In: YES user_id=3D879778 In fact I figured out the problem! You DO NOT factor in the Time Zone in your code. Hence the Date object offset the given time with the time zone. I reckon that you have run that test only in a time zone of GMT+1! When I change my system time zone to GMT+1, the test pass OK. To reproduce the bug, just change your system time zone on your test system, and your will see how the test fails. The FormatHelper dateTimeElement method needs to be changed accordingly so the tests pass correctly. BTW, I wonder how to set different "system" time zones automatically for the tests.... Also the code that was commented : /* * // mysteriously fails on some installation el =3D = (Element) * e.getElementsByTagName("hours").item(0); = assertEquals( "12", * el.getFirstChild().getNodeValue() ); */ was probably failing for the same reason!!! Cheers Philippe O. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=3Ddetail&atid=3D537539&aid=3D840442= &group_id=3D73357 |