AdminController { @DeleteMapping("/{provider}/{symbol}") public Response delete(Locale l, @PathVariable String symbol, @PathVariable String provider) { Response response = new Response(); adminService.delete(symbol, provider); response.setMessage(messageSource.getMessage("symbols.success.delete", new Object[] { symbol }, l)); response.setMessageTitle(messageSource.getMessage("success", null, l)); return response; }  @GetMapping SearchResult symbols(String code); @PostMapping("/{provider}/{code}") Response add(Locale l, @PathVariable String code, @PathVariable String provider); @DeleteMapping("/{provider}/{symbol}") Response delete(Locale l, @PathVariable String symbol, @PathVariable String provider);  }
@Test public void testDelete() throws Exception { mvc.perform(delete("/api/admin/YAHOO/UBI.PA")) .andExpect(status().is2xxSuccessful()); verify(adminService).delete(eq("UBI.PA"), eq("YAHOO")); }
@WithMockUser @Test public void testDeleteNotAdmin() throws Exception { mvc.perform(delete("/api/admin/YAHOO/UBI.PA")) .andExpect(status().isForbidden()); }