List of usage examples for org.springframework.mock.web MockHttpServletResponse getLocale
@Override
public Locale getLocale()
From source file:org.jtalks.jcommune.web.controller.UserProfileControllerTest.java
@Test(enabled = false) public void saveEditedProfileWithCorrectEnteredDataShouldMoveUserInUpdatedProfile() throws NotFoundException { JCUser user = getUser();//from w ww .j av a 2 s.c o m EditUserProfileDto userDto = getEditUserProfileDto(); MockHttpServletResponse response = new MockHttpServletResponse(); // when(userService.saveEditedUserProfile(anyLong(), any(UserInfoContainer.class))).thenReturn(user); when(userService.getCurrentUser()).thenReturn(user); BindingResult bindingResult = new BeanPropertyBindingResult(userDto, "editedUser"); ModelAndView mav = profileController.saveEditedProfile(userDto, bindingResult, response); String expectedUrl = "redirect:/users/" + user.getId(); assertViewName(mav, expectedUrl); assertEquals(response.getLocale().getLanguage(), user.getLanguage().getLocale().getLanguage()); verify(userService).saveEditedUserProfile(anyLong(), any(UserInfoContainer.class)); }