BasketController { @PostMapping("/baskets/{id}/add/{item}") BasketModel addItem(@PathVariable UUID id, @PathVariable String item) { BasketModel basketModel = one(id); basketModel.addItem(item); basketRepository.save(basketModel); return basketModel; } @Autowired  BasketController(BasketRepository basketRepository);   }
@Test public void addItem() { BasketModel basketModel = getMockedBasketModel("dummy"); BasketModel result = basketController.newBasket(basketModel); basketController.addItem(result.getId(), "item"); BasketModel storedResult = basketController.one(result.getId()); assert(storedResult.getItems().contains("item")); }