Service层修改 单元测试
This commit is contained in:
@@ -55,7 +55,6 @@ public class Other {
|
|||||||
Map<String, Long> countMap = new HashMap<>();
|
Map<String, Long> countMap = new HashMap<>();
|
||||||
countMap.put("articleCount", countService.getArticleCount());
|
countMap.put("articleCount", countService.getArticleCount());
|
||||||
countMap.put("commentCount", countService.getCommentCount());
|
countMap.put("commentCount", countService.getCommentCount());
|
||||||
countMap.put("leaveMsgCount", countService.getLeaveMessageCount());
|
|
||||||
countMap.put("categoryCount", countService.getCategoriesCount());
|
countMap.put("categoryCount", countService.getCategoriesCount());
|
||||||
countMap.put("tagCount", countService.getTagsCount());
|
countMap.put("tagCount", countService.getTagsCount());
|
||||||
countMap.put("visitorCount", countService.getVisitorCount());
|
countMap.put("visitorCount", countService.getVisitorCount());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.celess.blog.service;
|
package cn.celess.blog.service;
|
||||||
|
|
||||||
import cn.celess.blog.entity.User;
|
import cn.celess.blog.entity.User;
|
||||||
|
import cn.celess.blog.entity.model.PageData;
|
||||||
import cn.celess.blog.entity.model.UserModel;
|
import cn.celess.blog.entity.model.UserModel;
|
||||||
import cn.celess.blog.entity.request.LoginReq;
|
import cn.celess.blog.entity.request.LoginReq;
|
||||||
import cn.celess.blog.entity.request.UserReq;
|
import cn.celess.blog.entity.request.UserReq;
|
||||||
@@ -42,14 +43,6 @@ public interface UserService {
|
|||||||
*/
|
*/
|
||||||
Object logout();
|
Object logout();
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户头像的链接
|
|
||||||
*
|
|
||||||
* @param id 用户id
|
|
||||||
* @return 头像链接
|
|
||||||
*/
|
|
||||||
String getAvatarImg(long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户数据
|
* 更新用户数据
|
||||||
*
|
*
|
||||||
@@ -83,14 +76,6 @@ public interface UserService {
|
|||||||
*/
|
*/
|
||||||
String getUserRoleByEmail(String email);
|
String getUserRoleByEmail(String email);
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过邮箱获取用户的信息
|
|
||||||
*
|
|
||||||
* @param email 用户邮箱
|
|
||||||
* @return 用户信息
|
|
||||||
*/
|
|
||||||
User getUserInfoByEmail(String email);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取邮箱是否注册过
|
* 获取邮箱是否注册过
|
||||||
*
|
*
|
||||||
@@ -99,14 +84,6 @@ public interface UserService {
|
|||||||
*/
|
*/
|
||||||
boolean isExistOfEmail(String email);
|
boolean isExistOfEmail(String email);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户的name 优先返回displayName 否则返回email
|
|
||||||
*
|
|
||||||
* @param id 用户id
|
|
||||||
* @return name
|
|
||||||
*/
|
|
||||||
String getNameById(long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送重置密码邮件
|
* 发送重置密码邮件
|
||||||
*
|
*
|
||||||
@@ -157,7 +134,7 @@ public interface UserService {
|
|||||||
* @param page 数据页
|
* @param page 数据页
|
||||||
* @return 分页数据
|
* @return 分页数据
|
||||||
*/
|
*/
|
||||||
PageInfo<UserModel> getUserList(Integer page, Integer count);
|
PageData<UserModel> getUserList(Integer page, Integer count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更改用户信息
|
* 更改用户信息
|
||||||
@@ -177,10 +154,10 @@ public interface UserService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置密码
|
* 设置密码
|
||||||
* @param pwd
|
* @param pwd pwd
|
||||||
* @param newPwd
|
* @param newPwd newPwd
|
||||||
* @param confirmPwd
|
* @param confirmPwd confirmPwd
|
||||||
* @return
|
* @return UserModel
|
||||||
*/
|
*/
|
||||||
UserModel setPwd(String pwd, String newPwd, String confirmPwd);
|
UserModel setPwd(String pwd, String newPwd, String confirmPwd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package cn.celess.blog.service.serviceimpl;
|
package cn.celess.blog.service.serviceimpl;
|
||||||
|
|
||||||
import cn.celess.blog.enmu.ResponseEnum;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
|
import cn.celess.blog.enmu.RoleEnum;
|
||||||
import cn.celess.blog.entity.User;
|
import cn.celess.blog.entity.User;
|
||||||
|
import cn.celess.blog.entity.model.PageData;
|
||||||
import cn.celess.blog.entity.model.QiniuResponse;
|
import cn.celess.blog.entity.model.QiniuResponse;
|
||||||
import cn.celess.blog.entity.model.UserModel;
|
import cn.celess.blog.entity.model.UserModel;
|
||||||
import cn.celess.blog.entity.request.LoginReq;
|
import cn.celess.blog.entity.request.LoginReq;
|
||||||
@@ -26,7 +28,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import java.beans.Transient;
|
import java.beans.Transient;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -74,7 +75,8 @@ public class UserServiceImpl implements UserService {
|
|||||||
if (userMapper.existsByEmail(email)) {
|
if (userMapper.existsByEmail(email)) {
|
||||||
throw new MyException(ResponseEnum.USERNAME_HAS_EXIST);
|
throw new MyException(ResponseEnum.USERNAME_HAS_EXIST);
|
||||||
}
|
}
|
||||||
boolean b = userMapper.addUser(email, MD5Util.getMD5(password)) == 1;
|
User user = new User(email, MD5Util.getMD5(password));
|
||||||
|
boolean b = userMapper.addUser(user) == 1;
|
||||||
if (b) {
|
if (b) {
|
||||||
String verifyId = UUID.randomUUID().toString().replaceAll("-", "");
|
String verifyId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
redisUtil.setEx(email + "-verify", verifyId, 2, TimeUnit.DAYS);
|
redisUtil.setEx(email + "-verify", verifyId, 2, TimeUnit.DAYS);
|
||||||
@@ -116,7 +118,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
if (user.getPwd().equals(MD5Util.getMD5(loginReq.getPassword()))) {
|
if (user.getPwd().equals(MD5Util.getMD5(loginReq.getPassword()))) {
|
||||||
logger.info("====> {} 进行权限认证 状态:登录成功 <====", loginReq.getEmail());
|
logger.info("====> {} 进行权限认证 状态:登录成功 <====", loginReq.getEmail());
|
||||||
userMapper.updateLoginTime(loginReq.getEmail(), new Date());
|
userMapper.updateLoginTime(loginReq.getEmail());
|
||||||
redisUtil.delete(loginReq.getEmail() + "-passwordWrongTime");
|
redisUtil.delete(loginReq.getEmail() + "-passwordWrongTime");
|
||||||
// redis 标记
|
// redis 标记
|
||||||
redisUserUtil.set(user, loginReq.getIsRememberMe());
|
redisUserUtil.set(user, loginReq.getIsRememberMe());
|
||||||
@@ -137,7 +139,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
redisUtil.setEx(loginReq.getEmail() + "-passwordWrongTime", count + "", 2, TimeUnit.HOURS);
|
redisUtil.setEx(loginReq.getEmail() + "-passwordWrongTime", count + "", 2, TimeUnit.HOURS);
|
||||||
throw new MyException(ResponseEnum.LOGIN_FAILURE);
|
throw new MyException(ResponseEnum.LOGIN_FAILURE);
|
||||||
}
|
}
|
||||||
UserModel trans = trans(user);
|
UserModel trans = ModalTrans.user(user);
|
||||||
trans.setToken(token);
|
trans.setToken(token);
|
||||||
return trans;
|
return trans;
|
||||||
|
|
||||||
@@ -164,7 +166,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
userMapper.updateInfo(desc, displayName, user.getId());
|
userMapper.updateInfo(desc, displayName, user.getId());
|
||||||
redisUserUtil.set(user);
|
redisUserUtil.set(user);
|
||||||
return trans(user);
|
return ModalTrans.user(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -176,20 +178,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getUserInfoByEmail(String email) {
|
|
||||||
User user = userMapper.findByEmail(email);
|
|
||||||
if (user == null) {
|
|
||||||
throw new MyException(ResponseEnum.USER_NOT_EXIST);
|
|
||||||
}
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAvatarImg(long id) {
|
|
||||||
return userMapper.getAvatarImgUrlById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object updateUserAavatarImg(InputStream is, String mime) {
|
public Object updateUserAavatarImg(InputStream is, String mime) {
|
||||||
User user = redisUserUtil.get();
|
User user = redisUserUtil.get();
|
||||||
@@ -203,7 +191,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
@Override
|
@Override
|
||||||
public UserModel getUserInfoBySession() {
|
public UserModel getUserInfoBySession() {
|
||||||
User user = redisUserUtil.get();
|
User user = redisUserUtil.get();
|
||||||
return trans(user);
|
return ModalTrans.user(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -211,18 +199,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
return userMapper.existsByEmail(email);
|
return userMapper.existsByEmail(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNameById(long id) {
|
|
||||||
String name = userMapper.getDisPlayName(id);
|
|
||||||
if (name == null) {
|
|
||||||
name = userMapper.getEmail(id);
|
|
||||||
if (name == null) {
|
|
||||||
throw new MyException(ResponseEnum.USER_NOT_EXIST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 找回密码
|
* 找回密码
|
||||||
*/
|
*/
|
||||||
@@ -254,7 +230,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
return "发送成功!";
|
return "发送成功!";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
@Override
|
@Override
|
||||||
public Object sendVerifyEmail(String email) {
|
public Object sendVerifyEmail(String email) {
|
||||||
if (!RegexUtil.emailMatch(email)) {
|
if (!RegexUtil.emailMatch(email)) {
|
||||||
@@ -366,14 +341,12 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<UserModel> getUserList(Integer page, Integer count) {
|
public PageData<UserModel> getUserList(Integer page, Integer count) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<User> all = userMapper.findAll();
|
List<User> all = userMapper.findAll();
|
||||||
PageInfo pageInfo = PageInfo.of(all);
|
|
||||||
List<UserModel> modelList = new ArrayList<>();
|
List<UserModel> modelList = new ArrayList<>();
|
||||||
all.forEach(user -> modelList.add(trans(user)));
|
all.forEach(user -> modelList.add(ModalTrans.user(user)));
|
||||||
pageInfo.setList(modelList);
|
return new PageData<UserModel>(PageInfo.of(all), modelList);
|
||||||
return pageInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -402,8 +375,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
user.setPwd(MD5Util.getMD5(userReq.getPwd()));
|
user.setPwd(MD5Util.getMD5(userReq.getPwd()));
|
||||||
}
|
}
|
||||||
if (userReq.getRole() != null) {
|
if (userReq.getRole() != null) {
|
||||||
// TODO:用enum存放角色分类
|
if (RoleEnum.USER_ROLE.getRoleName().equals(userReq.getRole()) || RoleEnum.ADMIN_ROLE.getRoleName().equals(userReq.getRole())) {
|
||||||
if ("user".equals(userReq.getRole()) || "admin".equals(userReq.getRole())) {
|
|
||||||
user.setRole(userReq.getRole());
|
user.setRole(userReq.getRole());
|
||||||
} else {
|
} else {
|
||||||
throw new MyException(ResponseEnum.PARAMETERS_ERROR);
|
throw new MyException(ResponseEnum.PARAMETERS_ERROR);
|
||||||
@@ -413,7 +385,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
if (!RegexUtil.emailMatch(userReq.getEmail())) {
|
if (!RegexUtil.emailMatch(userReq.getEmail())) {
|
||||||
throw new MyException(ResponseEnum.PARAMETERS_EMAIL_ERROR);
|
throw new MyException(ResponseEnum.PARAMETERS_EMAIL_ERROR);
|
||||||
}
|
}
|
||||||
// TODO :: 邮件提醒
|
|
||||||
user.setEmail(userReq.getEmail());
|
user.setEmail(userReq.getEmail());
|
||||||
}
|
}
|
||||||
// 数据写入
|
// 数据写入
|
||||||
@@ -425,7 +396,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
redisUserUtil.set(user);
|
redisUserUtil.set(user);
|
||||||
}
|
}
|
||||||
logger.info("修改了用户 [id={}] 的用户的资料", userReq.getId());
|
logger.info("修改了用户 [id={}] 的用户的资料", userReq.getId());
|
||||||
return trans(user);
|
return ModalTrans.user(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -444,19 +415,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
throw new MyException(ResponseEnum.PWD_NOT_SAME);
|
throw new MyException(ResponseEnum.PWD_NOT_SAME);
|
||||||
}
|
}
|
||||||
userMapper.updatePwd(user.getEmail(), MD5Util.getMD5(newPwd));
|
userMapper.updatePwd(user.getEmail(), MD5Util.getMD5(newPwd));
|
||||||
return trans(userMapper.findByEmail(user.getEmail()));
|
return ModalTrans.user(userMapper.findByEmail(user.getEmail()));
|
||||||
}
|
|
||||||
|
|
||||||
private UserModel trans(User u) {
|
|
||||||
UserModel user = new UserModel();
|
|
||||||
user.setId(u.getId());
|
|
||||||
user.setAvatarImgUrl(u.getAvatarImgUrl() == null ? null : "http://cdn.celess.cn/" + u.getAvatarImgUrl());
|
|
||||||
user.setEmail(u.getEmail());
|
|
||||||
user.setDesc(u.getDesc());
|
|
||||||
user.setDisplayName(u.getDisplayName() == null ? u.getEmail() : u.getDisplayName());
|
|
||||||
user.setEmailStatus(u.getEmailStatus());
|
|
||||||
user.setRecentlyLandedDate(DateFormatUtil.get(u.getRecentlyLandedDate()));
|
|
||||||
user.setRole(u.getRole());
|
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public class ModalTrans {
|
|||||||
public static UserModel user(User user) {
|
public static UserModel user(User user) {
|
||||||
UserModel userModel = new UserModel();
|
UserModel userModel = new UserModel();
|
||||||
BeanUtils.copyProperties(user, userModel);
|
BeanUtils.copyProperties(user, userModel);
|
||||||
|
userModel.setAvatarImgUrl(user.getAvatarImgUrl() == null || user.getAvatarImgUrl().length() == 0 ?
|
||||||
|
null :
|
||||||
|
"http://cdn.celess.cn/" + user.getAvatarImgUrl());
|
||||||
|
userModel.setDisplayName(user.getDisplayName() == null ? user.getEmail() : user.getDisplayName());
|
||||||
|
userModel.setRecentlyLandedDate(DateFormatUtil.get(user.getRecentlyLandedDate()));
|
||||||
return userModel;
|
return userModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package cn.celess.blog.controller;
|
|||||||
|
|
||||||
import cn.celess.blog.BaseTest;
|
import cn.celess.blog.BaseTest;
|
||||||
import cn.celess.blog.entity.User;
|
import cn.celess.blog.entity.User;
|
||||||
|
import cn.celess.blog.entity.model.PageData;
|
||||||
import cn.celess.blog.entity.model.UserModel;
|
import cn.celess.blog.entity.model.UserModel;
|
||||||
import cn.celess.blog.entity.request.LoginReq;
|
import cn.celess.blog.entity.request.LoginReq;
|
||||||
import cn.celess.blog.entity.request.UserReq;
|
import cn.celess.blog.entity.request.UserReq;
|
||||||
import cn.celess.blog.mapper.UserMapper;
|
import cn.celess.blog.mapper.UserMapper;
|
||||||
import cn.celess.blog.util.MD5Util;
|
import cn.celess.blog.util.MD5Util;
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import net.sf.json.JSONArray;
|
import net.sf.json.JSONArray;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -50,8 +50,7 @@ public class UserControllerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void registration() {
|
public void registration() {
|
||||||
// 自行手动测试!
|
// ignore
|
||||||
// TODO :
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -136,7 +135,8 @@ public class UserControllerTest extends BaseTest {
|
|||||||
String s = UUID.randomUUID().toString();
|
String s = UUID.randomUUID().toString();
|
||||||
String email = s.substring(s.length() - 4) + "@celess.cn";
|
String email = s.substring(s.length() - 4) + "@celess.cn";
|
||||||
String pwd = MD5Util.getMD5("123456789");
|
String pwd = MD5Util.getMD5("123456789");
|
||||||
int i1 = userMapper.addUser(email, pwd);
|
User user = new User(email, pwd);
|
||||||
|
int i1 = userMapper.addUser(user);
|
||||||
if (i1 == 0) {
|
if (i1 == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,8 @@ public class UserControllerTest extends BaseTest {
|
|||||||
public void updateInfoByAdmin() throws Exception {
|
public void updateInfoByAdmin() throws Exception {
|
||||||
UserReq userReq = new UserReq();
|
UserReq userReq = new UserReq();
|
||||||
String email = UUID.randomUUID().toString().substring(0, 4) + "@celess.cn";
|
String email = UUID.randomUUID().toString().substring(0, 4) + "@celess.cn";
|
||||||
userMapper.addUser(email, MD5Util.getMD5("123456789"));
|
User user = new User(email, MD5Util.getMD5("123456789"));
|
||||||
|
userMapper.addUser(user);
|
||||||
User userByDb = userMapper.findByEmail(email);
|
User userByDb = userMapper.findByEmail(email);
|
||||||
userReq.setId(userByDb.getId());
|
userReq.setId(userByDb.getId());
|
||||||
userReq.setPwd(UUID.randomUUID().toString().replaceAll("-", "").substring(0, 10));
|
userReq.setPwd(UUID.randomUUID().toString().replaceAll("-", "").substring(0, 10));
|
||||||
@@ -194,12 +195,12 @@ public class UserControllerTest extends BaseTest {
|
|||||||
.andDo(result -> {
|
.andDo(result -> {
|
||||||
JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString());
|
JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString());
|
||||||
assertEquals(SUCCESS.getCode(), object.getInt(Code));
|
assertEquals(SUCCESS.getCode(), object.getInt(Code));
|
||||||
UserModel user = (UserModel) JSONObject.toBean(object.getJSONObject(Result), UserModel.class);
|
UserModel userModel = (UserModel) JSONObject.toBean(object.getJSONObject(Result), UserModel.class);
|
||||||
assertEquals(userReq.getId(), user.getId());
|
assertEquals(userReq.getId(), userModel.getId());
|
||||||
assertEquals(userReq.getRole(), user.getRole());
|
assertEquals(userReq.getRole(), userModel.getRole());
|
||||||
assertEquals(userReq.getEmail(), user.getEmail());
|
assertEquals(userReq.getEmail(), userModel.getEmail());
|
||||||
assertEquals(userReq.getDesc(), user.getDesc());
|
assertEquals(userReq.getDesc(), userModel.getDesc());
|
||||||
assertEquals(userReq.getDisplayName(), user.getDisplayName());
|
assertEquals(userReq.getDisplayName(), userModel.getDisplayName());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,14 +218,12 @@ public class UserControllerTest extends BaseTest {
|
|||||||
assertNotNull(object.getJSONObject(Result));
|
assertNotNull(object.getJSONObject(Result));
|
||||||
// 判断pageInfo是否包装完全
|
// 判断pageInfo是否包装完全
|
||||||
JSONObject resultJson = JSONObject.fromObject(object.getJSONObject(Result));
|
JSONObject resultJson = JSONObject.fromObject(object.getJSONObject(Result));
|
||||||
PageInfo pageInfo = (PageInfo) JSONObject.toBean(resultJson, PageInfo.class);
|
PageData<UserModel> pageData = (PageData<UserModel>) JSONObject.toBean(resultJson, PageData.class);
|
||||||
assertNotEquals(0, pageInfo.getTotal());
|
assertNotEquals(0, pageData.getTotal());
|
||||||
assertNotEquals(0, pageInfo.getStartRow());
|
assertEquals(1, pageData.getPageNum());
|
||||||
assertNotEquals(0, pageInfo.getEndRow());
|
assertEquals(10, pageData.getPageSize());
|
||||||
assertEquals(1, pageInfo.getPageNum());
|
|
||||||
assertEquals(10, pageInfo.getPageSize());
|
|
||||||
// 内容完整
|
// 内容完整
|
||||||
for (Object user : pageInfo.getList()) {
|
for (Object user : pageData.getList()) {
|
||||||
UserModel u = (UserModel) JSONObject.toBean(JSONObject.fromObject(user), UserModel.class);
|
UserModel u = (UserModel) JSONObject.toBean(JSONObject.fromObject(user), UserModel.class);
|
||||||
assertNotNull(u.getId());
|
assertNotNull(u.getId());
|
||||||
assertNotNull(u.getEmail());
|
assertNotNull(u.getEmail());
|
||||||
@@ -254,7 +253,7 @@ public class UserControllerTest extends BaseTest {
|
|||||||
@Test
|
@Test
|
||||||
public void setPwd() throws Exception {
|
public void setPwd() throws Exception {
|
||||||
String email = UUID.randomUUID().toString().substring(0, 4) + "@celess.cn";
|
String email = UUID.randomUUID().toString().substring(0, 4) + "@celess.cn";
|
||||||
assertEquals(1, userMapper.addUser(email, MD5Util.getMD5("1234567890")));
|
assertEquals(1, userMapper.addUser(new User(email, MD5Util.getMD5("1234567890"))));
|
||||||
LoginReq req = new LoginReq();
|
LoginReq req = new LoginReq();
|
||||||
req.setEmail(email);
|
req.setEmail(email);
|
||||||
req.setPassword("1234567890");
|
req.setPassword("1234567890");
|
||||||
|
|||||||
Reference in New Issue
Block a user