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