DbConfigurationController extends AbstractOhfController { @RequestMapping(value = "/{code:.+}", method = RequestMethod.PUT, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody public void update(@PathVariable final String code, @RequestBody @Valid final DbConfigurationParamRpc paramRpc, BindingResult errors) throws ValidationException, NoDataFoundException { Assert.notNull(paramRpc, "paramRpc can not be null"); if (hasText(paramRpc.getCode())) { Constraints.state(code.equals(paramRpc.getCode()), "codes must be equal"); } else { paramRpc.setCode(code); } DbConfigurationParam dbParam = getParam(code); paramRpc.updateEntity(dbParam, errors); paramService.update(dbParam); }  @RequestMapping(value = "", method = RequestMethod.GET, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.OK) @ResponseBody PagingWrapper<DbConfigurationParamRpc> findAll(Pageable pageable); @RequestMapping(value = "/{code:.+}", method = RequestMethod.GET, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.OK) @ResponseBody DbConfigurationParamRpc getByCode(@PathVariable final String code); @RequestMapping(value = "/{code:.+}", method = RequestMethod.PUT, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody void update(@PathVariable final String code, @RequestBody @Valid final DbConfigurationParamRpc paramRpc,
            BindingResult errors); static final String REST_URI; }
@Test public void testUpdate() throws Exception { final URIBuilder uriBuilder = createGetUrl(ROOT_URI + "/" + param.getCode()); JsonObject request = createJson() .add("code", param.getCode()) .add("categoryCode", param.getCategoryCode()) .add("dataType", param.getDataType().name()) .add("currentValue", 222) .add("defaultValue", 10) .build(); mockMvc.perform(put(toUrl(uriBuilder)) .content(request.toString()) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .with(SecurityMockMvcRequestPostProcessors.authentication(mockAuthentication("ADMIN")))) .andExpect(status().isNoContent()) .andExpect(content().string(isEmptyString())); DbConfigurationParam dbParam = paramService.getParameter(param.getId()); assertThat(Integer.valueOf(dbParam.getCurrentValue()), is(222)); assertThat(Integer.valueOf(dbParam.getDefaultValue()), is(10)); assertThat(param.getDataType(), is(DataTypeEnum.INT)); assertThat(param.isMandatory(), is(true)); }