mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、移除无用post岗位代码;2、发票管理单元测试完善,优惠活动单测覆盖率异常修复;
This commit is contained in:
+2
@@ -21,4 +21,6 @@ public @interface WithMockLoginUser {
|
||||
long deptId() default 0L;
|
||||
|
||||
boolean isSuperAdmin() default false;
|
||||
|
||||
long organId() default 0L;
|
||||
}
|
||||
+6
-2
@@ -2,6 +2,7 @@ package com.cf.imes.framework.security.test;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@@ -23,10 +24,13 @@ public class WithMockLoginUserSecurityContextFactory implements WithSecurityCont
|
||||
|
||||
LoginUser loginUser = new LoginUser();
|
||||
long annotationUserId = annotation.userId();
|
||||
long annotationOrganId = annotation.organId();
|
||||
String username = annotation.username();
|
||||
|
||||
loginUser.setId(annotationUserId == 0L ? RandomUtil.randomLong() : annotationUserId);
|
||||
loginUser.setNickname(RandomUtil.randomString(10));
|
||||
loginUser.setNickname(StringUtils.isNotEmpty(username) ? username : RandomUtil.randomString(10));
|
||||
loginUser.setDeptId(RandomUtil.randomLong());
|
||||
loginUser.setOrganId(RandomUtil.randomLong());
|
||||
loginUser.setOrganId(annotationOrganId == 0L ? RandomUtil.randomLong() : annotationOrganId);
|
||||
loginUser.setIsSupAdmin(annotation.isSuperAdmin());
|
||||
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
|
||||
|
||||
+4
-3
@@ -28,6 +28,8 @@ import java.util.stream.Stream;
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public class RandomUtils {
|
||||
private RandomUtils() {
|
||||
}
|
||||
|
||||
private static final int RANDOM_STRING_LENGTH = 10;
|
||||
|
||||
@@ -51,7 +53,7 @@ public class RandomUtils {
|
||||
}
|
||||
// 如果是 type、status 结尾的字段,返回 tinyint 范围
|
||||
if (CharSequenceUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(),
|
||||
"type", "status", "category", "scope", "result", "sort", "unit")) {
|
||||
"type", "status", "category", "scope", "result", "sort", "unit", "currency")) {
|
||||
return RandomUtil.randomInt(0, TINYINT_MAX + 1);
|
||||
}
|
||||
return RandomUtil.randomInt();
|
||||
@@ -142,8 +144,7 @@ public class RandomUtils {
|
||||
@SafeVarargs
|
||||
public static <T> List<T> randomPojoList(Class<T> clazz, Consumer<T>... consumers) {
|
||||
int size = RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH);
|
||||
return Stream.iterate(0, i -> i).limit(size).map(o -> randomPojo(clazz, consumers))
|
||||
.collect(Collectors.toList());
|
||||
return Stream.iterate(0, i -> i).limit(size).map(o -> randomPojo(clazz, consumers)).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user