Raghav1984 / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

Building 1.1.1 with java-1.8.0 tests fail - hash not matching? #97

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Hi,

Building json_simple 1.1.1 with

java-1.8.0-openjdk

maven-3.2.2

The tests unfortunately fail, I've attached the full build log

======array1==========
["abc\u0010a\/",123,222.123,true]
======obj1 with array1===========
{"name":"fang","weight":60.21,"array1":["abc\u0010a\/",123,222.123,true],"age":2
7,"is_developer":true}
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.165 sec <<< 
FAILURE! - in org.json.simple.Test
testEncode(org.json.simple.Test)  Time elapsed: 0.036 sec  <<< FAILURE!
junit.framework.ComparisonFailure: 
expected:<{"[array1":["abc\u0010a\/",123,222.123,true],"weight":60.21,"age":27,"
name":"fang"],"is_developer":true...> but 
was:<{"[name":"fang","weight":60.21,"array1":["abc\u0010a\/",123,222.123,true],"
age":27],"is_developer":true...>
        at junit.framework.Assert.assertEquals(Assert.java:100)
        at junit.framework.Assert.assertEquals(Assert.java:107)
        at junit.framework.TestCase.assertEquals(TestCase.java:269)
        at org.json.simple.Test.testEncode(Test.java:320)
Running org.json.simple.parser.YylexTest
"\/"
"abc\/\r\b\n\t\f\\"
[        

{               
^M}
^H^L{
error:Unexpected character ) at position 0.
{a : b}
error:Unexpected character (a) at position 1.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec - in 
org.json.simple.parser.YylexTest

Original issue reported on code.google.com by s.tray...@gmail.com on 21 Jul 2014 at 10:59

Attachments:

GoogleCodeExporter commented 8 years ago
The order of the hash in Java 8 changes, so the expect value doesn't match the 
result: it's not a problem of this library, but a problem of the test case. 
Just comment out the codes in JUnit test case and it should work.

Will fix the test case to avoid confusion. Thank you for reporting this issue.

Original comment by fangyid...@gmail.com on 21 Jul 2014 at 12:14

GoogleCodeExporter commented 8 years ago
Updated codes in SVN. To push it to maven repo.

Original comment by fangyid...@gmail.com on 26 Jul 2014 at 12:14