Export to GitHub

json-simple - issue #97

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


Posted on Jul 21, 2014 by Massive Ox

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":27,"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

Attachments

Comment #1

Posted on Jul 21, 2014 by Helpful Panda

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.

Comment #2

Posted on Jul 26, 2014 by Helpful Panda

Updated codes in SVN. To push it to maven repo.

Status: Fixed

Labels:
Type-Defect Priority-Medium