AdminController { @PostMapping("/{provider}/{code}") public Response add(Locale l, @PathVariable String code, @PathVariable String provider) throws IOException { Response response = new Response(); SymbolInfo si = adminService.add(code, provider); Object[] args = { si.getName(), si.getCode(), si.getQuote().getPrice(), si.getQuote().getCurrency(), si.getQuote().getTime() }; response.setMessage(messageSource.getMessage("symbols.success.add", args, l)); response.setMessageTitle(messageSource.getMessage("success", null, l)); if (!si.isHistoryFound()) { response.setWarningMessage(messageSource.getMessage("symbols.warning.no_historical_data", new Object[] { si.getCode() }, 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 testAdd() throws Exception { SymbolInfo si = new SymbolInfo("code", "name", true, new fr.ymanvieu.trading.common.provider.Quote("code", null, null)); when(adminService.add(eq("UBI.PA"), eq("YAHOO"))).thenReturn(si); mvc.perform(post("/api/admin/YAHOO/UBI.PA")) .andExpect(status().is2xxSuccessful()); }