mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
166ee9eeec
commit
1879292a11
@ -0,0 +1,23 @@
|
||||
package org.dromara.hutool.json;
|
||||
|
||||
import org.dromara.hutool.core.date.DateUtil;
|
||||
import org.dromara.hutool.json.writer.NumberWriteMode;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class IssueIALQ0NTest {
|
||||
|
||||
@Test
|
||||
void toJsonStrTest() {
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", 1826166955313201152L);
|
||||
map.put("createdDate", DateUtil.parse("2024-08-24"));
|
||||
final String jsonStr = JSONUtil.toJsonStr(map, JSONConfig.of()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
.setNumberWriteMode(NumberWriteMode.STRING));
|
||||
Assertions.assertEquals("{\"createdDate\":\"2024-08-24 00:00:00\",\"id\":\"1826166955313201152\"}", jsonStr);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user