mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
change name to DateFormatManager
This commit is contained in:
@@ -22,7 +22,7 @@ import org.dromara.hutool.core.annotation.PropIgnore;
|
||||
import org.dromara.hutool.core.collection.ListUtil;
|
||||
import org.dromara.hutool.core.date.DateFormatPool;
|
||||
import org.dromara.hutool.core.date.DateUtil;
|
||||
import org.dromara.hutool.core.date.format.GlobalCustomFormat;
|
||||
import org.dromara.hutool.core.date.format.DateFormatManager;
|
||||
import org.dromara.hutool.core.io.resource.ResourceUtil;
|
||||
import org.dromara.hutool.core.map.MapUtil;
|
||||
import org.dromara.hutool.core.text.StrUtil;
|
||||
@@ -491,7 +491,7 @@ public class JSONObjectTest {
|
||||
@Test
|
||||
public void setDateFormatSecondsTest() {
|
||||
// 自定义格式为只有秒的时间戳,一般用于JWT
|
||||
final JSONConfig jsonConfig = JSONConfig.of().setDateFormat(GlobalCustomFormat.FORMAT_SECONDS);
|
||||
final JSONConfig jsonConfig = JSONConfig.of().setDateFormat(DateFormatManager.FORMAT_SECONDS);
|
||||
|
||||
final Date date = DateUtil.parse("2020-06-05 11:16:11");
|
||||
final JSONObject json = new JSONObject(jsonConfig);
|
||||
@@ -507,7 +507,7 @@ public class JSONObjectTest {
|
||||
@Test
|
||||
public void setCustomDateFormatTest() {
|
||||
final JSONConfig jsonConfig = JSONConfig.of();
|
||||
jsonConfig.setDateFormat(GlobalCustomFormat.FORMAT_SECONDS);
|
||||
jsonConfig.setDateFormat(DateFormatManager.FORMAT_SECONDS);
|
||||
|
||||
final Date date = DateUtil.parse("2020-06-05 11:16:11");
|
||||
final JSONObject json = new JSONObject(jsonConfig);
|
||||
|
@@ -19,7 +19,7 @@ package org.dromara.hutool.json.jwt;
|
||||
import lombok.Data;
|
||||
import org.dromara.hutool.core.date.DateUtil;
|
||||
import org.dromara.hutool.core.date.TimeUtil;
|
||||
import org.dromara.hutool.core.date.format.GlobalCustomFormat;
|
||||
import org.dromara.hutool.core.date.format.DateFormatManager;
|
||||
import org.dromara.hutool.json.JSONConfig;
|
||||
import org.dromara.hutool.json.JSONObject;
|
||||
import org.dromara.hutool.json.JSONUtil;
|
||||
@@ -41,7 +41,7 @@ public class IssueI6IS5BTest {
|
||||
final JwtToken jwtToken = new JwtToken();
|
||||
jwtToken.setIat(iat);
|
||||
|
||||
final JSONObject payloadsData = JSONUtil.parseObj(jwtToken, JSONConfig.of().setDateFormat(GlobalCustomFormat.FORMAT_SECONDS));
|
||||
final JSONObject payloadsData = JSONUtil.parseObj(jwtToken, JSONConfig.of().setDateFormat(DateFormatManager.FORMAT_SECONDS));
|
||||
|
||||
final String token = JWTUtil.createToken(payloadsData, "123".getBytes(StandardCharsets.UTF_8));
|
||||
Assertions.assertEquals("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Nzc3NzI4MDB9.SXU_mm1wT5lNoK-Dq5Y8f3BItv_44zuAlyeWLqajpXg", token);
|
||||
@@ -62,7 +62,7 @@ public class IssueI6IS5BTest {
|
||||
final JwtToken2 jwtToken = new JwtToken2();
|
||||
jwtToken.setIat(iat);
|
||||
|
||||
final JSONObject payloadsData = JSONUtil.parseObj(jwtToken, JSONConfig.of().setDateFormat(GlobalCustomFormat.FORMAT_SECONDS));
|
||||
final JSONObject payloadsData = JSONUtil.parseObj(jwtToken, JSONConfig.of().setDateFormat(DateFormatManager.FORMAT_SECONDS));
|
||||
|
||||
final String token = JWTUtil.createToken(payloadsData, "123".getBytes(StandardCharsets.UTF_8));
|
||||
Assertions.assertEquals("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Nzc3NzI4MDB9.SXU_mm1wT5lNoK-Dq5Y8f3BItv_44zuAlyeWLqajpXg", token);
|
||||
|
Reference in New Issue
Block a user