use of org.simbasecurity.core.service.communication.reset.password.ResetPasswordService in project simba-os by cegeka.
the class UserFactoryTest method createUser_UserWithoutEmail_EmailRequiredAccordingToParameter_ShouldThrowAnException.
@Test
public void createUser_UserWithoutEmail_EmailRequiredAccordingToParameter_ShouldThrowAnException() {
User user = aDefaultUser().withoutEmail().withUserName("userName").build();
when(configurationService.getValue(SimbaConfigurationParameter.EMAIL_ADDRESS_REQUIRED)).thenReturn(true);
assertThatThrownBy(() -> userFactory.create(user)).extracting(t -> ((SimbaException) t).getMessageKey()).containsExactly(EMAIL_ADDRESS_REQUIRED);
verifyZeroInteractions(resetPasswordService);
verify(userRepository, never()).persist(any(User.class));
verify(managementAudit, never()).log(any(String.class), any(String.class));
}
Aggregations