@Test public void newBasket() { BasketModel basketModel = getMockedBasketModel("test"); BasketModel result = basketController.newBasket(basketModel); assert(result.getItems().contains("test")); assert(result.getId() != null); assert(result.getCreationPoint() != null); BasketModel storedResult = basketController.one(result.getId()); assert(result.getId().equals(storedResult.getId())); }
@PostMapping("/baskets") BasketModel newBasket(@RequestBody BasketModel basketModel) { if (Objects.isNull(basketModel.getCreationPoint())) { basketModel.setCreationPoint(null); } return basketRepository.save(basketModel); }
BasketController { @PostMapping("/baskets") BasketModel newBasket(@RequestBody BasketModel basketModel) { if (Objects.isNull(basketModel.getCreationPoint())) { basketModel.setCreationPoint(null); } return basketRepository.save(basketModel); } }
BasketController { @PostMapping("/baskets") BasketModel newBasket(@RequestBody BasketModel basketModel) { if (Objects.isNull(basketModel.getCreationPoint())) { basketModel.setCreationPoint(null); } return basketRepository.save(basketModel); } @Autowired  BasketController(BasketRepository basketRepository); }
BasketController { @PostMapping("/baskets") BasketModel newBasket(@RequestBody BasketModel basketModel) { if (Objects.isNull(basketModel.getCreationPoint())) { basketModel.setCreationPoint(null); } return basketRepository.save(basketModel); } @Autowired  BasketController(BasketRepository basketRepository);  }
BasketController { @PostMapping("/baskets") BasketModel newBasket(@RequestBody BasketModel basketModel) { if (Objects.isNull(basketModel.getCreationPoint())) { basketModel.setCreationPoint(null); } return basketRepository.save(basketModel); } @Autowired  BasketController(BasketRepository basketRepository);   }