StockAPI { @GetMapping public ResponseEntity<List<Stock>> findAll() { return ResponseEntity.ok(stockService.findAll()); }  @GetMapping ResponseEntity<List<Stock>> findAll(); @GetMapping("/{stockId}") ResponseEntity<Stock> findById(@PathVariable Long stockId); @PostMapping ResponseEntity create(@RequestBody Stock stock); @PatchMapping("/{stockId}") ResponseEntity<Stock> update(@PathVariable Long stockId, @RequestBody Stock updatingStock); @DeleteMapping("/{id}") ResponseEntity delete(@PathVariable Long id);  }
@Test public void findAll() throws Exception { Stock stock = new Stock(); stock.setId(1L); stock.setName("Stock 1"); stock.setPrice(new BigDecimal(1)); List<Stock> stocks = Arrays.asList(stock); given(stockService.findAll()).willReturn(stocks); this.mockMvc.perform(get("/api/v1/stocks")) .andExpect(status().isOk()) .andExpect(content().json("[{'id': 1,'name': 'Stock 1';'price': 1}]")); }