Class PromotionWithVoucherTest

All Implemented Interfaces:
JaloSessionHolder

public class PromotionWithVoucherTest extends AbstractPromotionServiceTest
  • Constructor Details

    • PromotionWithVoucherTest

      public PromotionWithVoucherTest()
  • Method Details

    • setUp

      public void setUp() throws Exception
      Overrides:
      setUp in class AbstractPromotionServiceTest
      Throws:
      Exception
    • testUnsavedCartEntryVsJaloCalculate

      public void testUnsavedCartEntryVsJaloCalculate() throws JaloPriceFactoryException
      Throws:
      JaloPriceFactoryException
    • testPromotionWithVoucher

      public void testPromotionWithVoucher() throws JaloPriceFactoryException
      Puts two products in the cart, applies one 10% product promotion, and redeems
      • 1. one voucher without free shipping or
      • 2. one voucher with free shipping or
      • 3. two vouchers, one with free shipping and the other one without.
      Throws:
      JaloPriceFactoryException
    • testPromotionWithProductRestrictionVoucher

      public void testPromotionWithProductRestrictionVoucher() throws CalculationException, JaloPriceFactoryException
      Tests promotion with voucher that has product restriction. (currency is Euro)
      • product(HW1230-0001) price = 769.00 --> 2x = 1538.00
      • product(HW2110-0012) price = 81.08 --> 2x = 162.16
      • so the cart contains products that cost 1700.16 Euro without promotion/voucher.
      • redeems the voucher that is 10% discount with product restriction: only valid for [HW1230-0001]
      • applies the fixed price promotion that is only valid for [HW1230-0001], and the fixed price is 500
      • update promotions, and the total discount should be (500 * 2) * 10% = 100
      • total price of the cart: (500 * 2 + 81.08 * 2) - 100 = 1062.16
      Throws:
      CalculationException
      JaloPriceFactoryException