单元测试,接入 h2 实现单元测试

This commit is contained in:
YunaiV
2021-02-28 13:29:24 +08:00
parent 99855e7cdc
commit 2f0d7e8aba
11 changed files with 371 additions and 49 deletions

View File

@ -27,7 +27,7 @@ public class RedisConfig {
template.setConnectionFactory(factory);
// 使用 String 序列化方式,序列化 KEY 。
template.setKeySerializer(RedisSerializer.string());
// 使用 JSON 序列化方式(库是 FastJSON ),序列化 VALUE 。
// 使用 JSON 序列化方式(库是 Jackson ),序列化 VALUE 。
template.setValueSerializer(RedisSerializer.json());
return template;
}

View File

@ -11,7 +11,7 @@ public interface InfErrorCodeConstants {
// ========== 参数配置 1001000000 ==========
ErrorCode CONFIG_NOT_FOUND = new ErrorCode(1001000001, "参数配置不存在");
ErrorCode CONFIG_NAME_DUPLICATE = new ErrorCode(1001000002, "参数配置 key 重复");
ErrorCode CONFIG_KEY_DUPLICATE = new ErrorCode(1001000002, "参数配置 key 重复");
ErrorCode CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE = new ErrorCode(1001000003, "不能删除类型为系统内置的参数配置");
ErrorCode CONFIG_GET_VALUE_ERROR_IF_SENSITIVE = new ErrorCode(1001000004, "不允许获取敏感配置到前端");

View File

@ -117,10 +117,10 @@ public class InfConfigServiceImpl implements InfConfigService {
}
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
if (id == null) {
throw ServiceExceptionUtil.exception(CONFIG_NAME_DUPLICATE);
throw ServiceExceptionUtil.exception(CONFIG_KEY_DUPLICATE);
}
if (!config.getId().equals(id)) {
throw ServiceExceptionUtil.exception(CONFIG_NAME_DUPLICATE);
throw ServiceExceptionUtil.exception(CONFIG_KEY_DUPLICATE);
}
}