コード例 #1
0
 @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);
 }
コード例 #2
0
 @Test
 public void testCheckNullNewPassword() {
   editUserProfileDto.setNewUserPassword(null);
   boolean isValid = validator.isValid(editUserProfileDto, validatorContext);
   Assert.assertEquals(isValid, true, "The null password is not valid.");
 }