ConfigController { @RequestMapping(path = "/{key:.+}", method = PUT) public void setKey( HttpServletRequest request, HttpServletResponse response, @PathVariable String key, @RequestBody(required = false) String value ) throws IOException { SessionEntry session = authFilter.handle(request, response); if (session == null) { return; } if (!configService.setKey(session.getUser(), key, value)) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } @Autowired  ConfigController(ConfigService configService, AuthFilter authFilter); @GetMapping Configuration get(HttpServletRequest request, HttpServletResponse response); @RequestMapping(path = "/{key:.+}", method = PUT) void setKey(
		HttpServletRequest request,
		HttpServletResponse response,
		@PathVariable String key,
		@RequestBody(required = false) String value
	); @RequestMapping(path = "/{key:.+}", method = DELETE) void unsetKey(
		HttpServletRequest request,
		HttpServletResponse response,
		@PathVariable String key
	);  }
@Test public void testSetKey() throws Exception { mockMvc.perform(put("/config/key") .content("value") .contentType(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()); verify(configService).setKey(anyInt(), eq("key"), eq("value")); }