You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Ben Sommerville (JIRA)" <ta...@jakarta.apache.org> on 2006/07/30 07:39:14 UTC

[jira] Updated: (TAPESTRY-1028) Unit tests using JSONObject.toString are fragile & may break in different environments.

     [ http://issues.apache.org/jira/browse/TAPESTRY-1028?page=all ]

Ben Sommerville updated TAPESTRY-1028:
--------------------------------------

    Attachment: TAP-1028.patch

Patch to fix the failing tests.

The fix is for the JSONObject to use LinkedHashMap internally.  This provides a guaranteed iteration order & allows the tests to work in any environment.

There were 2 other tests did not involve JSONObject that were failing.

ClientPropertyPersistenceStrategyTest failed for the same reason (iteration order of the _data HashMap).  Fixed it by changing _data to LinkedHashMap as well.

TestDateValidator.testToObjectInvalid also failed.  In this case because the actual message said "Format is MM/DD/YYYY" rather than "Format is MM/dd/yyyy.".  Fixed this by changing the expected value of the message.



> Unit tests using JSONObject.toString are fragile & may break in different environments.
> ---------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1028
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1028
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1
>         Environment: Windows XP,  JDK 1.5.0_06
>            Reporter: Ben Sommerville
>            Priority: Minor
>         Attachments: TAP-1028.patch
>
>
> JSONObject.toString writes out its contents by iterating thru the keys of its internal HashMap.  However the HashMap class makes no guarantees about the ordering of iterators, so the keys + values may be written out in any order.
> The trouble is that the unit tests compare JSONObject.toString to hardcoded strings.  If the iteration order happens to match the test string then all is well.  If it doesn't match then the tests fail, even tho the functionality being tested is working correctly.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://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