feat:统一公共审计填充并调整系统枚举接口风格
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.bruce.common.config;
|
||||
|
||||
import com.bruce.rag.entity.RagStore;
|
||||
import org.apache.ibatis.reflection.SystemMetaObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
class EntityAuditMetaObjectHandlerTests {
|
||||
|
||||
@Test
|
||||
void insertFillShouldPopulateAuditFields() {
|
||||
EntityAuditMetaObjectHandler handler = new EntityAuditMetaObjectHandler();
|
||||
RagStore entity = new RagStore();
|
||||
|
||||
handler.insertFill(SystemMetaObject.forObject(entity));
|
||||
|
||||
assertNotNull(entity.getCreateTime());
|
||||
assertNotNull(entity.getUpdateTime());
|
||||
assertEquals("system", entity.getCreateBy());
|
||||
assertEquals("system", entity.getUpdateBy());
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateFillShouldRefreshUpdateAuditFields() {
|
||||
EntityAuditMetaObjectHandler handler = new EntityAuditMetaObjectHandler();
|
||||
RagStore entity = new RagStore();
|
||||
entity.setUpdateBy("oldUser");
|
||||
|
||||
handler.updateFill(SystemMetaObject.forObject(entity));
|
||||
|
||||
assertNotNull(entity.getUpdateTime());
|
||||
assertEquals("system", entity.getUpdateBy());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user