@Before public void init() { cart = genericFactory.getBean(SapordermgmtbolConstants.ALIAS_BO_CART); productId = "A"; newItem.setQuantity(new BigDecimal(quantity)); newItem.setProductId(productId); newItem.setTechKey(new TechKey(itemKey)); cart.setHeader(new HeaderSalesDocument()); final ItemListImpl itemList = new ItemListImpl(); itemList.add(newItem); cart.setItemList(itemList); bolCartFacade = EasyMock.createMock(BolCartFacade.class); EasyMock.expect(bolCartFacade.addToCart(productId, quantity)).andReturn(newItem); EasyMock.expect(bolCartFacade.validateCart()).andReturn(messageList); EasyMock.expect(bolCartFacade.getCart()).andReturn(cart).anyTimes(); EasyMock.expect(bolCartFacade.hasCart()).andReturn(new Boolean(false)); EasyMock.expect(bolCartFacade.createCart()).andReturn(cart); EasyMock.expect(bolCartFacade.addConfigurationToCart(configModel)).andReturn(itemKey); bolCartFacade.updateConfigurationInCart("A", configModel); final Map<String, String> deliveryTypes = new HashMap<>(); EasyMock.expect(bolCartFacade.getAllowedDeliveryTypes()).andReturn(deliveryTypes); bolCartFacade.releaseCart(); EasyMock.replay(bolCartFacade); classUnderTest.setBolCartFacade(bolCartFacade); classUnderTest.setCartItemConverter(createCartItemConverter()); classUnderTest.setCartConverter(createCartConverter()); }
private Item prepareItem() { final Item item = (Item) genericFactory.getBean(SapordermgmtbolConstants.ALIAS_BEAN_ITEM); item.setProductId(PRODUCT_ID); item.setQuantity(QUANTITY); item.setProductGuid(new TechKey(PRODUCT_KEY)); item.setUnit(UNIT); return item; }