mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
短信管理单元测试完善
This commit is contained in:
+2
@@ -14,6 +14,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@WithSecurityContext(factory = WithMockLoginUserSecurityContextFactory.class)
|
||||
public @interface WithMockLoginUser {
|
||||
long userId() default 0L;
|
||||
|
||||
String username() default "";
|
||||
|
||||
long deptId() default 0L;
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ public class WithMockLoginUserSecurityContextFactory implements WithSecurityCont
|
||||
SecurityContext context = SecurityContextHolder.createEmptyContext();
|
||||
|
||||
LoginUser loginUser = new LoginUser();
|
||||
long annotationUserId = annotation.userId();
|
||||
loginUser.setId(annotationUserId == 0L ? RandomUtil.randomLong() : annotationUserId);
|
||||
loginUser.setNickname(RandomUtil.randomString(10));
|
||||
loginUser.setDeptId(RandomUtil.randomLong());
|
||||
loginUser.setOrganId(RandomUtil.randomLong());
|
||||
|
||||
Reference in New Issue
Block a user