@@ -400,7 +400,8 @@ public Object resolveArgument(org.springframework.core.MethodParameter parameter
400400 .setControllerAdvice (new TestExceptionHandler ())
401401 .build ();
402402
403- when (messageSource .getMessage (eq ("message.update-password.success" ), any (), any (Locale .class )))
403+ when (userService .findUserByEmail (testUser .getEmail ())).thenReturn (testUser );
404+ when (messageSource .getMessage (eq ("message.update-password.success" ), any (), any (), any (Locale .class )))
404405 .thenReturn ("Password updated successfully" );
405406 when (userService .checkIfValidOldPassword (any (User .class ), eq ("oldPassword" ))).thenReturn (true );
406407
@@ -443,7 +444,8 @@ public Object resolveArgument(org.springframework.core.MethodParameter parameter
443444 .setControllerAdvice (new TestExceptionHandler ())
444445 .build ();
445446
446- when (messageSource .getMessage (eq ("message.update-password.invalid-old" ), any (), any (Locale .class )))
447+ when (userService .findUserByEmail (testUser .getEmail ())).thenReturn (testUser );
448+ when (messageSource .getMessage (eq ("message.update-password.invalid-old" ), any (), any (), any (Locale .class )))
447449 .thenReturn ("Invalid old password" );
448450 when (userService .checkIfValidOldPassword (any (User .class ), eq ("wrongPassword" ))).thenReturn (false );
449451
@@ -509,7 +511,8 @@ public Object resolveArgument(org.springframework.core.MethodParameter parameter
509511 .setControllerAdvice (new TestExceptionHandler ())
510512 .build ();
511513
512- when (messageSource .getMessage (eq ("message.update-user.success" ), any (), any (Locale .class )))
514+ when (userService .findUserByEmail (testUser .getEmail ())).thenReturn (testUser );
515+ when (messageSource .getMessage (eq ("message.update-user.success" ), any (), any (), any (Locale .class )))
513516 .thenReturn ("Profile updated successfully" );
514517 when (userService .saveRegisteredUser (any (User .class ))).thenReturn (testUser );
515518
@@ -522,8 +525,8 @@ public Object resolveArgument(org.springframework.core.MethodParameter parameter
522525 .andExpect (jsonPath ("$.success" ).value (true ))
523526 .andExpect (jsonPath ("$.messages[0]" ).value ("Profile updated successfully" ));
524527
525- verify (userService ).saveRegisteredUser (argThat (user ->
526- user .getFirstName ().equals ("UpdatedFirst" ) &&
528+ verify (userService ).saveRegisteredUser (argThat (user ->
529+ user .getFirstName ().equals ("UpdatedFirst" ) &&
527530 user .getLastName ().equals ("UpdatedLast" )
528531 ));
529532 }
@@ -741,7 +744,8 @@ public Object resolveArgument(org.springframework.core.MethodParameter parameter
741744 .setControllerAdvice (new TestExceptionHandler ())
742745 .build ();
743746
744- when (messageSource .getMessage (eq ("message.update-user.success" ), any (), any (Locale .class )))
747+ when (userService .findUserByEmail (testUser .getEmail ())).thenReturn (testUser );
748+ when (messageSource .getMessage (eq ("message.update-user.success" ), any (), any (), any (Locale .class )))
745749 .thenReturn ("Profile updated successfully" );
746750 when (userService .saveRegisteredUser (any (User .class ))).thenReturn (testUser );
747751
0 commit comments