Skip to content

JsonPathSelectorTest在不同JDK下会测试失败 #289

@suemi994

Description

@suemi994

本人测试环境 JDK:1.8,MAC OSX
出现以下错误

Expected :'{"author":"Nigel Rees","title":"Sayings of the Century","category":"reference","price":8.95}'
Actual :'{"author":"Nigel Rees","price":8.95,"category":"reference","title":"Sayings of the Century"}'

是由于JsonPath read后生成的Hash key的顺序不能保证与字段出现顺序一致,建议改为:

JSONObject object1=JSON.parseObject(select);
    JSONObject object2=JSON.parseObject("{\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"category\":\"reference\",\"price\":8.95}");
    assertEquals(object1,object2);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions