mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.dromara.hutool.json;
|
||||
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.json.serializer.JSONMapper;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -27,11 +26,11 @@ public class IssueI9DX5HTest {
|
||||
@Test
|
||||
void xmlToJSONTest() {
|
||||
final String xml = "<GoodMsg>你好</GoodMsg>";
|
||||
final JSONMapper mapper = JSONMapper.of(JSONConfig.of(), entry -> {
|
||||
final JSONFactory factory = JSONFactory.of(JSONConfig.of(), entry -> {
|
||||
entry.setKey(StrUtil.toUnderlineCase((CharSequence) entry.getKey()));
|
||||
return true;
|
||||
});
|
||||
final JSONObject jsonObject = (JSONObject) mapper.map(xml);
|
||||
final JSONObject jsonObject = (JSONObject) factory.parse(xml);
|
||||
|
||||
Assertions.assertEquals("{\"good_msg\":\"你好\"}", jsonObject.toString());
|
||||
}
|
||||
|
Reference in New Issue
Block a user