public void testPlaceOrderAction() throws Exception { final CartModel sessionCart = cartService.getSessionCart(); modelService.refresh(sessionCart); sessionCart.setCalculated(Boolean.TRUE); modelService.save(sessionCart); Assert.assertEquals(Boolean.TRUE, sessionCart.getCalculated()); Assert.assertNotNull("cart not null", sessionCart); Assert.assertNotNull("user not null", sessionCart.getUser()); Assert.assertEquals("DC S No", sessionCart.getUser().getUid()); Assert.assertNotNull(sessionCart.getPaymentInfo()); Assert.assertThat(sessionCart.getPaymentInfo(), instanceOf(CreditCardPaymentInfoModel.class)); final ReplenishmentProcessModel replenishmentProcessModel = createReplenishmentProcess(); Assert.assertFalse(processParameterHelper.containsParameter(replenishmentProcessModel, "cart")); processParameterHelper.setProcessParameter(replenishmentProcessModel, "cart", sessionCart); modelService.save(replenishmentProcessModel); Assert.assertTrue(processParameterHelper.containsParameter(replenishmentProcessModel, "cart")); placeOrderAction.execute(replenishmentProcessModel); }
public void testConfirmationAction() throws Exception { Assert.assertNotNull(mockEventService); confirmationAction.setEventService(mockEventService); final CartModel sessionCart = cartService.getSessionCart(); modelService.refresh(sessionCart); sessionCart.setCalculated(Boolean.TRUE); modelService.save(sessionCart); Assert.assertEquals(Boolean.TRUE, sessionCart.getCalculated()); Assert.assertNotNull("cart not null", sessionCart); Assert.assertNotNull("user not null", sessionCart.getUser()); Assert.assertEquals("DC S No", sessionCart.getUser().getUid()); Assert.assertNotNull(sessionCart.getPaymentInfo()); final ReplenishmentProcessModel replenishmentProcessModel = createReplenishmentProcess(); Assert.assertFalse( processParameterHelper.containsParameter(replenishmentProcessModel, "order")); processParameterHelper.setProcessParameter( replenishmentProcessModel, "order", commerceCheckoutService.placeOrder(cartService.getSessionCart())); modelService.save(replenishmentProcessModel); Assert.assertTrue(processParameterHelper.containsParameter(replenishmentProcessModel, "order")); confirmationAction.executeAction(replenishmentProcessModel); }