mirror of
https://gitee.com/dromara/hutool.git
synced 2025-10-07 15:14:42 +08:00
add test
This commit is contained in:
@@ -9,12 +9,14 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
public class IssueID0HP2Test {
|
||||
/**
|
||||
* JSON转换为XML时使用自定义格式
|
||||
* JSON转换为XML时使用自定义格式<br>
|
||||
* putValue时就会把日期转为自定义格式的字符串,因此转XML是直接转换
|
||||
*/
|
||||
@Test
|
||||
void jsonWithDateToXmlTest() {
|
||||
final JSONObject json = JSONUtil.ofObj(JSONConfig.of().setDateFormat("yyyy/MM/dd"))
|
||||
.putValue("date", DateUtil.parse("2025-10-03"));
|
||||
|
||||
String xml = JSONUtil.toXmlStr(json);
|
||||
Assertions.assertEquals("<date>2025/10/03</date>", xml);
|
||||
}
|
||||
|
Reference in New Issue
Block a user