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);
 }
  @Before
  public void beforeTest() throws Exception {
    MockitoAnnotations.initMocks(this);
    // inject a mock payment provider
    cardPaymentService.setCommandFactoryRegistry(mockupCommandFactoryRegistry);
    paymentService.setCardPaymentService(cardPaymentService);
    commerceCheckoutService.setPaymentService(paymentService);

    createCoreData();
    createDefaultCatalog();

    importCsv("/energizercore/test/testOrganizations.csv", "utf-8");
    importCsv("/energizercore/test/testB2BCommerceCart.csv", "utf-8");

    final CartModel modelByExample = new CartModel();
    modelByExample.setCode("dc_shhCart_b2bas");

    final CartModel cart = flexibleSearchService.getModelByExample(modelByExample);
    Assert.assertNotNull(cart);
    cartService.setSessionCart(cart);
    userService.setCurrentUser(cart.getUser());

    if (flexibleSearchService
        .search(
            "SELECT {"
                + ServicelayerJobModel.PK
                + "} FROM {"
                + ServicelayerJobModel._TYPECODE
                + "} WHERE "
                + "{"
                + ServicelayerJobModel.SPRINGID
                + "}=?springid",
            Collections.singletonMap("springid", "b2bAcceleratorCartToOrderJob"))
        .getResult()
        .isEmpty()) {
      final ServicelayerJobModel servicelayerJobModel =
          modelService.create(ServicelayerJobModel.class);
      servicelayerJobModel.setCode("b2bAcceleratorCartToOrderJob");
      servicelayerJobModel.setSpringId("b2bAcceleratorCartToOrderJob");
      modelService.save(servicelayerJobModel);
    }

    final Date startDate = new Date();
    final Integer day = Integer.valueOf(5);
    final Integer week = Integer.valueOf(2);
    final List<DayOfWeek> days = new ArrayList<DayOfWeek>();
    days.add(DayOfWeek.TUESDAY);
    days.add(DayOfWeek.FRIDAY);
    triggerModel = modelService.create(TriggerModel.class);
    triggerModel.setRelative(Boolean.TRUE);
    triggerModel.setActivationTime(startDate);
    triggerModel.setDay(day);
    triggerModel.setWeekInterval(week);
    triggerModel.setDaysOfWeek(days);

    cartToOrderCronJob = modelService.create(CartToOrderCronJobModel.class);
    cartToOrderCronJob.setCart(cartService.getSessionCart());
    cartToOrderCronJob.setDeliveryAddress(userService.getCurrentUser().getDefaultShipmentAddress());
    cartToOrderCronJob.setPaymentAddress(userService.getCurrentUser().getDefaultPaymentAddress());
    cartToOrderCronJob.setPaymentInfo(cartService.getSessionCart().getPaymentInfo());
    setCronJobToTrigger(cartToOrderCronJob, Collections.singletonList(triggerModel));
    cartToOrderCronJob.setJob(cronJobService.getJob("b2bAcceleratorCartToOrderJob"));
    modelService.save(cartToOrderCronJob);
    final BaseSiteModel site = baseSiteService.getBaseSiteForUID("b2bstoretemplate");
    Assert.assertNotNull("no site found for id 'site'", site);
    baseSiteService.setCurrentBaseSite(site, false);
  }