增加 podam 随机生成对象,简化单元测试的成本

This commit is contained in:
YunaiV
2021-03-03 01:33:05 +08:00
parent 92997a0cd5
commit 632be011b3
7 changed files with 55 additions and 35 deletions

View File

@ -122,7 +122,7 @@ public class DBConfigRepository extends AbstractConfigRepository {
private Properties buildProperties(List<InfConfigDO> configs) {
Properties properties = propertiesFactory.getPropertiesInstance();
configs.stream().filter(config -> 0 == config.getDeleted()) // 过滤掉被删除的配置
configs.stream().filter(BaseDO::getDeleted) // 过滤掉被删除的配置
.forEach(config -> properties.put(config.getKey(), config.getValue()));
return properties;
}

View File

@ -32,6 +32,6 @@ public class BaseDO implements Serializable {
* 是否删除
*/
@TableLogic
private Integer deleted;
private Boolean deleted;
}

View File

@ -85,7 +85,7 @@ public class SysAuthServiceImpl implements SysAuthService {
@Override
public String login(SysAuthLoginReqVO reqVO, String userIp, String userAgent) {
// 判断验证码是否正确
// this.verifyCaptcha(reqVO.getUsername(), reqVO.getUuid(), reqVO.getCode());
this.verifyCaptcha(reqVO.getUsername(), reqVO.getUuid(), reqVO.getCode());
// 使用账号密码,进行登陆。
LoginUser loginUser = this.login0(reqVO.getUsername(), reqVO.getPassword());
@ -99,11 +99,13 @@ public class SysAuthServiceImpl implements SysAuthService {
String code = captchaService.getCaptchaCode(captchaUUID);
// 验证码不存在
if (code == null) {
// 创建登陆失败日志(验证码不存在)
this.createLoginLog(username, SysLoginResultEnum.CAPTCHA_NOT_FOUND);
throw ServiceExceptionUtil.exception(AUTH_LOGIN_CAPTCHA_NOT_FOUND);
}
// 验证码不正确
if (!code.equals(captchaCode)) {
// 创建登陆失败日志(验证码不正确)
this.createLoginLog(username, SysLoginResultEnum.CAPTCHA_CODE_ERROR);
throw ServiceExceptionUtil.exception(AUTH_LOGIN_CAPTCHA_CODE_ERROR);
}