refactor(common): 统一通用常量与日志时间格式

This commit is contained in:
zhiye.sun
2026-05-21 15:36:51 +08:00
parent 8532628171
commit 2ab02fb574
10 changed files with 107 additions and 8 deletions

View File

@@ -0,0 +1,30 @@
package com.bruce.common.constant;
import com.bruce.common.config.AttachmentProperties;
import com.bruce.common.domain.model.RequestResult;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class CommonConstsStructureTests {
@Test
void commonConstsShouldExposeReusableInfrastructureConstants() {
assertEquals("yyyy-MM-dd HH:mm:ss", CommonConsts.DATE_FORMAT_LONG_STR);
assertEquals("yyyy-MM-dd HH:mm:ss.SSS", CommonConsts.DATE_FORMAT_MILLIS_STR);
assertEquals("GMT+8", CommonConsts.TIME_ZONE_GMT8);
assertEquals("data/attachments", CommonConsts.DEFAULT_ATTACHMENT_BASE_PATH);
assertEquals("LOCAL", CommonConsts.STORAGE_TYPE_LOCAL);
assertEquals("0", CommonConsts.REQUEST_RESULT_SUCCESS_CODE);
assertEquals("-1", CommonConsts.REQUEST_RESULT_FAIL_CODE);
}
@Test
void sharedDefaultConstantsShouldBeReusedByCommonComponents() {
AttachmentProperties properties = new AttachmentProperties();
assertEquals(CommonConsts.DEFAULT_ATTACHMENT_BASE_PATH, properties.getBasePath());
assertEquals(CommonConsts.REQUEST_RESULT_SUCCESS_CODE, RequestResult.SUCCESS_CODE);
assertEquals(CommonConsts.REQUEST_RESULT_FAIL_CODE, RequestResult.FAIL_CODE);
}
}