use of com.ncedu.fooddelivery.api.v1.entities.User in project 2021-msk-food-delivery by netcracker-edu.
the class UserServiceTest method lockUserSuccess.
@Test
public void lockUserSuccess() {
User penny = UserUtils.clientPennyTeller(1L);
when(userRepoMock.save(any(User.class))).thenAnswer(invocation -> invocation.getArguments()[0]);
UserInfoDTO resultDTO = userService.lockUser(penny);
assertTrue(resultDTO.getLockDate() != null);
verify(userRepoMock, times(1)).save(any(User.class));
}
use of com.ncedu.fooddelivery.api.v1.entities.User in project 2021-msk-food-delivery by netcracker-edu.
the class UserServiceTest method changeEmailPasswordMismatch.
@Test
public void changeEmailPasswordMismatch() {
Long userId = 1L;
User howard = UserUtils.courierHowardWolowitz(userId);
String newEmail = "happy-howard@bigbang.theory";
when(userRepoMock.findByEmail(newEmail)).thenReturn(null);
String password = "wrong-password";
EmailChangeDTO changeDTO = new EmailChangeDTO();
changeDTO.setEmail(newEmail);
changeDTO.setPassword(password);
assertThrows(PasswordsMismatchException.class, () -> {
userService.changeEmail(howard, changeDTO);
});
verify(userRepoMock, times(1)).findByEmail(newEmail);
verify(userRepoMock, never()).save(any(User.class));
}
use of com.ncedu.fooddelivery.api.v1.entities.User in project 2021-msk-food-delivery by netcracker-edu.
the class UserUtils method clientPennyTeller.
public static User clientPennyTeller(Long id) {
final String fullName = "Penny Teller";
final String email = "penny@bigbang.theory";
final Role role = Role.CLIENT;
return createUser(id, fullName, email, role);
}
use of com.ncedu.fooddelivery.api.v1.entities.User in project 2021-msk-food-delivery by netcracker-edu.
the class UserUtils method adminSheldonCooper.
public static User adminSheldonCooper(Long id) {
final String fullName = "Sheldon Lee Cooper";
final String email = "cooper@bigbang.theory";
final Role role = Role.ADMIN;
return createUser(id, fullName, email, role);
}
use of com.ncedu.fooddelivery.api.v1.entities.User in project 2021-msk-food-delivery by netcracker-edu.
the class UserUtils method clientRajeshKoothrappali.
public static User clientRajeshKoothrappali(Long id) {
final String fullName = "Rajesh Ramayan Koothrappali";
final String email = "rajesh@bigbang.theory";
final Role role = Role.CLIENT;
return createUser(id, fullName, email, role);
}
Aggregations