code:     public void resetPassword_InvalidPasswordException_NewPasswordSameAsOld() {
          ScimUser user = new ScimUser("user-id", "username", "firstname", "lastname");
          user.setMeta(new ScimMeta(new Date(), new Date(), 0));
          user.setPrimaryEmail("foo@example.com");
          ExpiringCode expiringCode = new ExpiringCode("good_code",
              new Timestamp(System.currentTimeMillis() + UaaResetPasswordService.PASSWORD_RESET_LIFETIME), "user-id", null);
          when(codeStore.retrieveCode("good_code")).thenReturn(expiringCode);
          when(scimUserProvisioning.retrieve("user-id")).thenReturn(user);
          when(scimUserProvisioning.checkPasswordMatches("user-id", "Passwo3dAsOld"))
              .thenThrow(new InvalidPasswordException("Your new password cannot be the same as the old password.", UNPROCESSABLE_ENTITY));
          SecurityContext securityContext = mock(SecurityContext.class);
          when(securityContext.getAuthentication()).thenReturn(new MockAuthentication());
          SecurityContextHolder.setContext(securityContext);
          try {
              emailResetPasswordService.resetPassword("good_code", "Passwo3dAsOld");
              fail();
          } catch (InvalidPasswordException e) {
              assertEquals("Your new password cannot be the same as the old password.", e.getMessage());
              assertEquals(UNPROCESSABLE_ENTITY, e.getStatus());
          }
      }
  
      @Test
  