public void testRecalculateCartAction() throws Exception {
   Assert.assertNotNull("cart not null", cartService.getSessionCart());
   Assert.assertNotNull("user not null", cartService.getSessionCart().getUser());
   Assert.assertEquals("DC S No", cartService.getSessionCart().getUser().getUid());
   final ReplenishmentProcessModel replenishmentProcessModel = createReplenishmentProcess();
   Assert.assertFalse(processParameterHelper.containsParameter(replenishmentProcessModel, "cart"));
   processParameterHelper.setProcessParameter(
       replenishmentProcessModel, "cart", cartService.getSessionCart());
   modelService.save(replenishmentProcessModel);
   Assert.assertTrue(processParameterHelper.containsParameter(replenishmentProcessModel, "cart"));
   calculateCartAction.executeAction(replenishmentProcessModel);
 }
 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 testAuthorizePaymentAction() throws Exception {
   Assert.assertNotNull("cart not null", cartService.getSessionCart());
   Assert.assertNotNull("user not null", cartService.getSessionCart().getUser());
   Assert.assertEquals("DC S No", cartService.getSessionCart().getUser().getUid());
   Assert.assertNotNull(cartService.getSessionCart().getPaymentInfo());
   Assert.assertThat(
       cartService.getSessionCart().getPaymentInfo(),
       instanceOf(CreditCardPaymentInfoModel.class));
   final ReplenishmentProcessModel replenishmentProcessModel = createReplenishmentProcess();
   Assert.assertFalse(processParameterHelper.containsParameter(replenishmentProcessModel, "cart"));
   processParameterHelper.setProcessParameter(
       replenishmentProcessModel, "cart", cartService.getSessionCart());
   modelService.save(replenishmentProcessModel);
   Assert.assertTrue(processParameterHelper.containsParameter(replenishmentProcessModel, "cart"));
   Assert.assertEquals(
       AbstractSimpleDecisionAction.Transition.OK,
       authorizePaymentAction.executeAction(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);
 }