VenController { @RequestMapping(value = "/{venID}/cleanRegistration", method = RequestMethod.POST) @ResponseBody public void cleanRegistration(@PathVariable("venID") String venUsername, HttpServletResponse response) { Ven ven = venService.findOneByUsername(venUsername); if (ven == null) { LOGGER.warn("Unknown Ven: " + venUsername); response.setStatus(HttpStatus.NOT_FOUND_404); return; } venService.cleanRegistration(ven); response.setStatus(HttpStatus.OK_200); LOGGER.info("Clean registration of Ven: " + ven.getUsername()); }  @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody List<VenDto> listVen(); @RequestMapping(value = "/search", method = RequestMethod.POST) @ResponseBody List<VenDto> searchVen(@RequestBody List<VenFilter> filters, @RequestParam("page") int page,
			@RequestParam("size") int size, HttpServletResponse response); @RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createVen(@Valid @RequestBody VenCreateDto dto,
			HttpServletResponse response); @RequestMapping(value = "/{venID}", method = RequestMethod.PUT) @ResponseBody VenCreateDto updateVen(@PathVariable("venID") String venUsername, @Valid @RequestBody VenUpdateDto dto,
			HttpServletResponse response); @RequestMapping(value = "/{venID}", method = RequestMethod.GET) @ResponseBody VenDto findVenByUsername(@PathVariable("venID") String venUsername, HttpServletResponse response); @RequestMapping(value = "/{venID}", method = RequestMethod.DELETE) @ResponseBody void deleteVenByUsername(@PathVariable("venID") String venUsername, HttpServletResponse response); @RequestMapping(value = "/{venID}/resource", method = RequestMethod.POST) @ResponseBody VenResourceDto createVenResource(@PathVariable("venID") String venUsername, @RequestBody VenResourceDto dto,
			HttpServletResponse response); @RequestMapping(value = "/{venID}/resource", method = RequestMethod.GET) @ResponseBody List<VenResourceDto> listVenResource(@PathVariable("venID") String venUsername,
			HttpServletResponse response); @RequestMapping(value = "/{venID}/resource/{resourceName}", method = RequestMethod.DELETE) @ResponseBody void deleteVenResource(@PathVariable("venID") String venUsername,
			@PathVariable("resourceName") String resourceName, HttpServletResponse response); @RequestMapping(value = "/{venID}/group", method = RequestMethod.POST) @ResponseBody VenCreateDto addGroupToVen(@PathVariable("venID") String venUsername, @RequestParam("groupId") Long groupId,
			HttpServletResponse response); @RequestMapping(value = "/{venID}/group", method = RequestMethod.GET) @ResponseBody List<VenGroupDto> listVenGroup(@PathVariable("venID") String venUsername, HttpServletResponse response); @RequestMapping(value = "/{venID}/group/remove", method = RequestMethod.POST) @ResponseBody void deleteVenGroup(@PathVariable("venID") String venUsername, @RequestParam("groupId") Long groupId,
			HttpServletResponse response); @RequestMapping(value = "/{venID}/marketContext", method = RequestMethod.POST) @ResponseBody VenCreateDto addMarketContextToVen(@PathVariable("venID") String venUsername,
			@RequestParam("marketContextId") Long marketContextId, HttpServletResponse response); @RequestMapping(value = "/{venID}/marketContext", method = RequestMethod.GET) @ResponseBody List<VenMarketContextDto> listVenMarketContext(@PathVariable("venID") String venUsername,
			HttpServletResponse response); @RequestMapping(value = "/{venID}/marketContext/remove", method = RequestMethod.POST) @ResponseBody void deleteVenMarketContext(@PathVariable("venID") String venUsername,
			@RequestParam("marketContextId") Long marketContextId, HttpServletResponse response); @RequestMapping(value = "/{venID}/cleanRegistration", method = RequestMethod.POST) @ResponseBody void cleanRegistration(@PathVariable("venID") String venUsername, HttpServletResponse response);  }
@Test public void cleanRegistrationTest() throws Exception { this.mockMvc .perform(MockMvcRequestBuilders.post(VEN_URL + "mouaiccool/cleanRegistration") .header("Content-Type", "application/json").with(adminSession)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.NOT_FOUND_404)); Ven prepare = venService.prepare("ven1"); prepare.setRegistrationId("mouaiccool"); venService.save(prepare); this.mockMvc .perform(MockMvcRequestBuilders.post(VEN_URL + "ven1/cleanRegistration") .header("Content-Type", "application/json").with(adminSession)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)); Ven findOneByUsername = venService.findOneByUsername("ven1"); assertNull(findOneByUsername.getRegistrationId()); venService.delete(findOneByUsername); }