AppController { @DeleteMapping("/apps/{appId:.+}") public void delete(@PathVariable("appId") String appId, @RequestParam String operator) { App entity = appService.findOne(appId); if (entity == null) { throw new NotFoundException("app not found for appId " + appId); } adminService.deleteApp(entity, operator); } AppController(final AppService appService, final AdminService adminService); @PostMapping("/apps") AppDTO create(@Valid @RequestBody AppDTO dto); @DeleteMapping("/apps/{appId:.+}") void delete(@PathVariable("appId") String appId, @RequestParam String operator); @PutMapping("/apps/{appId:.+}") void update(@PathVariable String appId, @RequestBody App app); @GetMapping("/apps") List<AppDTO> find(@RequestParam(value = "name", required = false) String name,
                           Pageable pageable); @GetMapping("/apps/{appId:.+}") AppDTO get(@PathVariable("appId") String appId); @GetMapping("/apps/{appId}/unique") boolean isAppIdUnique(@PathVariable("appId") String appId);  }
@Test @Sql(scripts = "/controller/cleanup.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testDelete() { AppDTO dto = generateSampleDTOData(); App app = BeanUtils.transform(App.class, dto); app = appRepository.save(app); restTemplate.delete("http: App deletedApp = appRepository.findById(app.getId()).orElse(null); Assert.assertNull(deletedApp); }