mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
19
hutool-json/src/test/java/cn/hutool/json/IssueI676ITTest.java
Executable file
19
hutool-json/src/test/java/cn/hutool/json/IssueI676ITTest.java
Executable file
@@ -0,0 +1,19 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.json.xml.JSONXMLSerializer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
|
||||
public class IssueI676ITTest {
|
||||
@Test
|
||||
public void parseXMLTest() {
|
||||
final JSONObject jsonObject = JSONUtil.parseObj(ResourceUtil.readUtf8Str("issueI676IT.json"));
|
||||
final String xmlStr = JSONXMLSerializer.toXml(jsonObject, null, (String) null);
|
||||
final String content = String.valueOf(XmlUtil.getByXPath("/page/orderItems[1]/content", XmlUtil.readXML(xmlStr), XPathConstants.STRING));
|
||||
Assert.assertEquals(content, "bar1");
|
||||
}
|
||||
}
|
19
hutool-json/src/test/resources/IssueI676IT.json
Executable file
19
hutool-json/src/test/resources/IssueI676IT.json
Executable file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"page": {
|
||||
"pageSize": 33,
|
||||
"currentPage": 81,
|
||||
"totalSize": 49,
|
||||
"orderItems": [
|
||||
{
|
||||
"asc": true,
|
||||
"columnName": "foo",
|
||||
"content": "bar1"
|
||||
},
|
||||
{
|
||||
"asc": false,
|
||||
"columnName": "foo",
|
||||
"content": "bar2"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user