test_class.declarator: mockMvc
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: stockService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private StockService stockService;
test_class.type: StockService
test_class.var_name: stockService
test_class.file: springboot-examples/springboot-mockmvc-hsql/src/test/java/com/hellokoding/springboot/restful/StockAPITest.java
test_class.identifier: StockAPITest
test_case.body: @Test
      public void findAll() throws Exception {
          // given
          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);
  
          // when + then
          this.mockMvc.perform(get("/api/v1/stocks"))
                  .andExpect(status().isOk())
                  .andExpect(content().json("[{'id': 1,'name': 'Stock 1';'price': 1}]"));
      }
test_case.class_method_signature: StockAPITest.findAll()
test_case.full_signature: @Test public void findAll()
test_case.identifier: findAll
test_case.invocations: setId setName setPrice asList willReturn given findAll andExpect andExpect perform get isOk status json content
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void findAll()
focal_class.declarator: stockService
focal_class.modifier: private final
focal_class.original_string: private final StockService stockService;
focal_class.type: StockService
focal_class.var_name: stockService
focal_class.file: springboot-examples/springboot-mockmvc-hsql/src/main/java/com/hellokoding/springboot/restful/StockAPI.java
focal_class.identifier: StockAPI
focal_class.class_method_signature: StockAPI.findAll()
focal_class.full_signature: @GetMapping public ResponseEntity<List<Stock>> findAll()
focal_class.identifier: findAll
focal_class.modifiers: @GetMapping public
focal_class.parameters: ()
focal_class.return: ResponseEntity<List<Stock>>
focal_class.signature: ResponseEntity<List<Stock>> findAll()
focal_class.class_method_signature: StockAPI.findById(@PathVariable Long stockId)
focal_class.full_signature: @GetMapping("/{stockId}") public ResponseEntity<Stock> findById(@PathVariable Long stockId)
focal_class.identifier: findById
focal_class.modifiers: @GetMapping("/{stockId}") public
focal_class.parameters: (@PathVariable Long stockId)
focal_class.return: ResponseEntity<Stock>
focal_class.signature: ResponseEntity<Stock> findById(@PathVariable Long stockId)
focal_class.class_method_signature: StockAPI.create(@RequestBody Stock stock)
focal_class.full_signature: @PostMapping public ResponseEntity create(@RequestBody Stock stock)
focal_class.identifier: create
focal_class.modifiers: @PostMapping public
focal_class.parameters: (@RequestBody Stock stock)
focal_class.return: ResponseEntity
focal_class.signature: ResponseEntity create(@RequestBody Stock stock)
focal_class.class_method_signature: StockAPI.update(@PathVariable Long stockId, @RequestBody Stock updatingStock)
focal_class.full_signature: @PatchMapping("/{stockId}") public ResponseEntity<Stock> update(@PathVariable Long stockId, @RequestBody Stock updatingStock)
focal_class.identifier: update
focal_class.modifiers: @PatchMapping("/{stockId}") public
focal_class.parameters: (@PathVariable Long stockId, @RequestBody Stock updatingStock)
focal_class.return: ResponseEntity<Stock>
focal_class.signature: ResponseEntity<Stock> update(@PathVariable Long stockId, @RequestBody Stock updatingStock)
focal_class.class_method_signature: StockAPI.delete(@PathVariable Long id)
focal_class.full_signature: @DeleteMapping("/{id}") public ResponseEntity delete(@PathVariable Long id)
focal_class.identifier: delete
focal_class.modifiers: @DeleteMapping("/{id}") public
focal_class.parameters: (@PathVariable Long id)
focal_class.return: ResponseEntity
focal_class.signature: ResponseEntity delete(@PathVariable Long id)
focal_method.body: @GetMapping
      public ResponseEntity<List<Stock>> findAll() {
          return ResponseEntity.ok(stockService.findAll());
      }
focal_method.class_method_signature: StockAPI.findAll()
focal_method.full_signature: @GetMapping public ResponseEntity<List<Stock>> findAll()
focal_method.identifier: findAll
focal_method.invocations: ok findAll
focal_method.modifiers: @GetMapping public
focal_method.parameters: ()
focal_method.return: ResponseEntity<List<Stock>>
focal_method.signature: ResponseEntity<List<Stock>> findAll()