### Question:
TransactionalUserService extends AbstractTransactionalEntityService<JCUser, UserDao> implements UserService, UserReader { @Override public void changeLanguage(JCUser jcUser, Language newLang) { jcUser.setLanguage(newLang); this.getDao().saveOrUpdate(jcUser); } TransactionalUserService(UserDao dao,
                                    GroupDao groupDao,
                                    SecurityService securityService,
                                    MailService mailService,
                                    Base64Wrapper base64Wrapper,
                                    EncryptionService encryptionService,
                                    PostDao postDao,
                                    Authenticator authenticator); @Override JCUser getByUsername(String username); @Override User getCommonUserByUsername(String username); @Override List<String> getUsernames(String pattern); @Override JCUser getCurrentUser(); @Override void updateLastLoginTime(JCUser user); @Override JCUser saveEditedUserProfile(
            long editedUserId, UserInfoContainer editedUserProfileInfo); @Override JCUser saveEditedUserSecurity(long editedUserId, UserSecurityContainer userSecurityInfo); @Override JCUser saveEditedUserNotifications(long editedUserId, UserNotificationsContainer userNotificationsInfo); @Override void restorePassword(String email); @Override JCUser getByUuid(String uuid); @Override // Temporarily disabled. Until we find the bug due to which activated users become not activated. // @Scheduled(cron = "0 * * * * *") // cron expression: invoke every hour at :00 min, e.g. 11:00, 12:00 and so on void deleteUnactivatedAccountsByTimer(); @Override @PreAuthorize("hasPermission(#userId, 'USER', 'ProfilePermission.EDIT_OTHERS_PROFILE')") void checkPermissionToEditOtherProfiles(Long userId); @Override @PreAuthorize("hasPermission(#userId, 'USER', 'ProfilePermission.EDIT_OWN_PROFILE')") void checkPermissionToEditOwnProfile(Long userId); @Override @PreAuthorize("hasPermission(#userId, 'USER', 'ProfilePermission.CREATE_FORUM_FAQ')") void checkPermissionToCreateAndEditSimplePage(Long userId); @Override AuthenticationStatus loginUser(LoginUserDto loginUserDto, HttpServletRequest request, HttpServletResponse response); @Override String processUserBbCodesInPost(String postContent); @Override void notifyAndMarkNewlyMentionedUsers(Post post); @Override void changeLanguage(JCUser jcUser, Language newLang); @Override @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')") List<JCUser> findByUsernameOrEmail(long forumComponentId, String searchKey); @Override List<UserDto> findByUsernameOrEmailNotInGroup(String pattern, long groupId, int count); @Override @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')") List<Long> getUserGroupIDs(long forumComponentId, long userID); @Override @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')") void addUserToGroup(long forumComponentId, long userID, long groupID); @Override @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')") void deleteUserFromGroup(long forumComponentId, long userID, long groupID);  }### Answer:
@Test public void testChangeLanguage() { final JCUser user = user(USERNAME); user.setLanguage(Language.ENGLISH); userService.changeLanguage(user, Language.RUSSIAN); verify(userDao).saveOrUpdate(argThat(new ArgumentMatcher<JCUser>() { @Override public boolean matches(Object argument) { JCUser argUser = (JCUser) argument; return argument == user && Language.RUSSIAN.equals(argUser.getLanguage()); } })); }