|
|
@ -297,27 +297,20 @@ public class UsersServiceTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testUpdateUser() { |
|
|
|
public void testUpdateUser() throws IOException { |
|
|
|
String userName = "userTest0001"; |
|
|
|
String userName = "userTest0001"; |
|
|
|
String userPassword = "userTest0001"; |
|
|
|
String userPassword = "userTest0001"; |
|
|
|
try { |
|
|
|
|
|
|
|
// user not exist
|
|
|
|
// user not exist
|
|
|
|
Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, |
|
|
|
Map<String, Object> result = usersService.updateUser(getLoginUser(), 0, userName, userPassword, |
|
|
|
"3443@qq.com", 1, "13457864543", "queue", 1, "Asia/Shanghai"); |
|
|
|
"3443@qq.com", 1, "13457864543", "queue", 1, "Asia/Shanghai"); |
|
|
|
Assertions.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS)); |
|
|
|
Assertions.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS)); |
|
|
|
logger.info(result.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// success
|
|
|
|
// success
|
|
|
|
when(userMapper.selectById(1)).thenReturn(getUser()); |
|
|
|
when(userMapper.selectById(1)).thenReturn(getUser()); |
|
|
|
when(userMapper.updateById(getUser())).thenReturn(1); |
|
|
|
when(userMapper.updateById(any())).thenReturn(1); |
|
|
|
result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "32222s@qq.com", 1, |
|
|
|
result = usersService.updateUser(getLoginUser(), 1, userName, userPassword, "32222s@qq.com", 1, |
|
|
|
"13457864543", "queue", 1, "Asia/Shanghai"); |
|
|
|
"13457864543", "queue", 1, "Asia/Shanghai"); |
|
|
|
logger.info(result.toString()); |
|
|
|
|
|
|
|
Assertions.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); |
|
|
|
Assertions.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error("update user error", e); |
|
|
|
|
|
|
|
Assertions.fail(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|