@BeforeMethod public void init() { MockitoAnnotations.initMocks(this); Mockito.when(userService.getCurrentUser()) .thenReturn(new JCUser("username", "email", userCurrentPassword)); validator = new ChangedPasswordValidator(userService, encryptionService); // editUserProfileDto.setCurrentUserPassword(userCurrentPassword); editUserProfileDto.setNewUserPassword(userNewPassword); }
@Test public void testCheckNullNewPassword() { editUserProfileDto.setNewUserPassword(null); boolean isValid = validator.isValid(editUserProfileDto, validatorContext); Assert.assertEquals(isValid, true, "The null password is not valid."); }