use of com.ncedu.fooddelivery.api.v1.dto.user.ClientInfoDTO 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.ClientInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class ClientServiceTest method getClientDTOByIdSuccess.
@Test
public void getClientDTOByIdSuccess() {
Long userId = 1L;
Client client = ClientUtils.createLeonardHofstadter(userId);
when(clientRepoMock.findById(userId)).thenReturn(Optional.of(client));
ClientInfoDTO resultClientDTO = clientService.getClientDTOById(userId);
ClientInfoDTO perfectClientDTO = ClientUtils.createClientInfoDTO(client);
verify(clientRepoMock, times(1)).findById(userId);
assertEquals(perfectClientDTO, resultClientDTO);
}
Aggregations