use of com.ncedu.fooddelivery.api.v1.dto.user.UserInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class UserServiceTest method unlockUserSuccess.
@Test
public void unlockUserSuccess() {
User penny = UserUtils.clientPennyTeller(1L);
Timestamp current = new Timestamp(System.currentTimeMillis());
penny.setLockDate(current);
UserInfoDTO resultDTO = userService.unlockUser(penny);
assertEquals(null, resultDTO.getLockDate());
verify(userRepoMock, times(1)).save(any(User.class));
}
use of com.ncedu.fooddelivery.api.v1.dto.user.UserInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class UserServiceTest method getUserDTOByIdSuccess.
@Test
public void getUserDTOByIdSuccess() {
Long userId = 1L;
User sheldonCooper = UserUtils.adminSheldonCooper(userId);
when(userRepoMock.findById(userId)).thenReturn(Optional.of(sheldonCooper));
UserInfoDTO resultDTO = userService.getUserDTOById(userId);
UserInfoDTO perfectDTO = UserUtils.createUserDTO(sheldonCooper);
assertEquals(perfectDTO, resultDTO);
verify(userRepoMock, times(1)).findById(userId);
}
use of com.ncedu.fooddelivery.api.v1.dto.user.UserInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class ProfileControllerTest method getClientProfile.
@Test
public void getClientProfile() {
ClientInfoDTO clientInfoDTO = new ClientInfoDTO(1L, "CLIENT", "client@mail.ru");
when(clientServiceMock.getClientDTOById(1L)).thenReturn(clientInfoDTO);
User user = new User();
user.setId(1L);
user.setRole(Role.CLIENT);
UserInfoDTO resultClientDTO = profileController.getProfile(user);
assertEquals(clientInfoDTO, resultClientDTO);
}
use of com.ncedu.fooddelivery.api.v1.dto.user.UserInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class ProfileControllerTest method getModeratorProfile.
@Test
public void getModeratorProfile() {
ModeratorInfoDTO moderatorInfoDTO = new ModeratorInfoDTO(1L, "MODERATOR", "moderator@mail.ru");
when(moderatorServiceMock.getModeratorDTOById(1L)).thenReturn(moderatorInfoDTO);
User user = new User();
user.setId(1L);
user.setRole(Role.MODERATOR);
UserInfoDTO resultModeratorDTO = profileController.getProfile(user);
assertEquals(moderatorInfoDTO, resultModeratorDTO);
}
use of com.ncedu.fooddelivery.api.v1.dto.user.UserInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class ProfileControllerTest method getAdminProfile.
@Test
public void getAdminProfile() {
UserInfoDTO userInfoDTO = new UserInfoDTO(1L, "ADMIN", "admin@mail.ru");
when(userServiceMock.getUserDTOById(1L)).thenReturn(userInfoDTO);
User user = new User();
user.setId(1L);
user.setRole(Role.ADMIN);
UserInfoDTO resultUserDTO = profileController.getProfile(user);
assertEquals(userInfoDTO, resultUserDTO);
}
Aggregations