### Question:
PageSettingsController { @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/pageSettings", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<SimpleRestResponse<PageSettingsDto>> updatePageSettings(@RequestBody PageSettingsRequest request) { if (request == null || request.isEmpty()) { DataBinder binder = new DataBinder(request); BindingResult bindingResult = binder.getBindingResult(); bindingResult.reject("NotEmpty.pagesettings.params"); throw new ValidationGenericException(bindingResult); } PageSettingsDto pageSettings = this.getPageSettingsService().updatePageSettings(request); return new ResponseEntity<>(new SimpleRestResponse<>(pageSettings), HttpStatus.OK); }  IPageSettingsService getPageSettingsService(); void setPageSettingsService(IPageSettingsService pageSettingsService); @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/pageSettings", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<PageSettingsDto>> getPageSettings(); @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/pageSettings", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<PageSettingsDto>> updatePageSettings(@RequestBody PageSettingsRequest request);  }### Answer:
@Test public void should_not_update_with_empty_list_of_settings() throws Exception { UserDetails user = createManagePagesUser(); String accessToken = mockOAuthInterceptor(user); when(pageSettingsService.updatePageSettings(createMockRequestEmptyParams())).thenReturn(createMockDto()); ResultActions result = mockMvc.perform( put("/pageSettings") .contentType(MediaType.APPLICATION_JSON) .content(convertObjectToJsonBytes(createMockRequestEmptyParams())) .header("Authorization", "Bearer " + accessToken) ); result.andExpect(status().isBadRequest()); }
@Test public void should_update_with_a_valid_list_of_settings() throws Exception { UserDetails user = createManagePagesUser(); String accessToken = mockOAuthInterceptor(user); when(pageSettingsService.updatePageSettings(createMockRequest())).thenReturn(createMockDto()); ResultActions result = mockMvc.perform( put("/pageSettings") .contentType(MediaType.APPLICATION_JSON) .content(convertObjectToJsonBytes(createMockRequest())) .header("Authorization", "Bearer " + accessToken) ); result.andExpect(status().isOk()); }