@Test @Transactional public void testGetAllCarts() throws Exception { long timeOfPlanting = System.currentTimeMillis(); User adam = _dbInjecter.injectUser("Adam"); TreeType treeType = _dbInjecter.injectTreeType("wood", "wood desc", 0.5); Project project = _dbInjecter.injectProject("project", adam, "project desc", true, 1.0f, 1.0f); _dbInjecter.injectProjectArticle(treeType, project, 1.0); _dbInjecter.injectTreeToProject(treeType, adam, 1, timeOfPlanting, project); String userToken = _tokenAuthenticationService.getTokenFromUser(_userRepository.findById(1L).orElse(null)); List<Long> treeIdList = new ArrayList<>(); treeIdList.add(1L); _dbInjecter.injectCart("Adam", treeIdList); CartRequest cartRequest = new CartRequest(); mockMvc.perform( post(Uris.CARTS).header("X-AUTH-TOKEN", userToken).content(TestUtil.convertObjectToJsonBytes(cartRequest)).contentType(TestUtil.APPLICATION_JSON_UTF8).accept("application/json")) .andExpect(status().isOk()).andExpect(jsonPath("$.[0].buyer.name").value("Adam")); }
@RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) public Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest) { return cartService.searchCarts(cartRequest); }
CartController { @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) public Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest) { return cartService.searchCarts(cartRequest); } }
CartController { @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) public Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest) { return cartService.searchCarts(cartRequest); }  }
CartController { @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) public Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest) { return cartService.searchCarts(cartRequest); }  @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest); @RequestMapping(value = "/cart/{cartId}") @Transactional @JsonView(Views.CartDetails.class) Cart getCartDetails(@PathVariable(value = "cartId") Long cartId); @PostMapping(value = "/cart/receiptable") @JsonView(Views.OverviewCart.class) Cart setReceiptable(@RequestParam Long cartId, @RequestParam boolean receiptable); @RequestMapping(value = Uris.CHANGE_CART_STATE, method = RequestMethod.POST) ResponseEntity<?> changeCartState(@RequestParam Long cartId, @RequestParam CartState cartState); }
CartController { @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) public Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest) { return cartService.searchCarts(cartRequest); }  @RequestMapping(value = Uris.CARTS, method = RequestMethod.POST) @JsonView(Views.OverviewCart.class) Iterable<Cart> getAllCarts(@RequestBody CartRequest cartRequest); @RequestMapping(value = "/cart/{cartId}") @Transactional @JsonView(Views.CartDetails.class) Cart getCartDetails(@PathVariable(value = "cartId") Long cartId); @PostMapping(value = "/cart/receiptable") @JsonView(Views.OverviewCart.class) Cart setReceiptable(@RequestParam Long cartId, @RequestParam boolean receiptable); @RequestMapping(value = Uris.CHANGE_CART_STATE, method = RequestMethod.POST) ResponseEntity<?> changeCartState(@RequestParam Long cartId, @RequestParam CartState cartState);  }