Class BandedPriceFulfillmentTest

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.broadleafcommerce.core.pricing.service.fulfillment.BandedPriceFulfillmentTest
All Implemented Interfaces:
junit.framework.Test

public class BandedPriceFulfillmentTest extends junit.framework.TestCase
Author:
Phillip Verheyden
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.broadleafcommerce.common.money.Money
    calculationResponse(org.broadleafcommerce.core.order.domain.FulfillmentOption option, org.broadleafcommerce.core.order.domain.Order order)
     
    protected org.broadleafcommerce.core.order.domain.Order
    createCandidateOrder(BigDecimal total, int orderItemsToCreate, String[] flatRates, int[] quantities, org.broadleafcommerce.core.order.domain.FulfillmentOption option)
     
    protected org.broadleafcommerce.core.order.domain.Order
    createCandidateOrder(BigDecimal retailTotal, int orderItemsToCreate, org.broadleafcommerce.core.order.domain.FulfillmentOption option)
     
    protected org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption
    createPriceBands(String[] minimumAmounts, String[] resultAmounts, org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType[] resultAmountTypes)
    Creates price bands with the given minimum amounts, results and result types.
    protected org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOption
    createWeightBands(String[] minimumAmounts, String[] resultAmounts, org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType[] resultAmountTypes)
     
    void
     
    void
     
    void
    If the retail price sum falls within 2 bands but with the same retail minimum, the lowest price should be selected
    void
     
    void
     
    void
     
    void
     
    void
     

    Methods inherited from class junit.framework.TestCase

    assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BandedPriceFulfillmentTest

      public BandedPriceFulfillmentTest()
  • Method Details

    • testPriceBandRate

      public void testPriceBandRate() throws Exception
      Throws:
      Exception
    • testMinimumAmountsWithZero

      public void testMinimumAmountsWithZero() throws Exception
      Throws:
      Exception
    • testPriceBandPercentage

      public void testPriceBandPercentage() throws Exception
      Throws:
      Exception
    • testPriceBandRatesWithPercentages

      public void testPriceBandRatesWithPercentages() throws Exception
      Throws:
      Exception
    • testLowestPriceSelection

      public void testLowestPriceSelection() throws Exception
      If the retail price sum falls within 2 bands but with the same retail minimum, the lowest price should be selected
      Throws:
      Exception
    • testFlatRatesExclusive

      public void testFlatRatesExclusive() throws Exception
      Throws:
      Exception
    • testFlatRatesWithBands

      public void testFlatRatesWithBands() throws Exception
      Throws:
      Exception
    • testWeightBandsWithQuantities

      public void testWeightBandsWithQuantities() throws Exception
      Throws:
      Exception
    • createCandidateOrder

      protected org.broadleafcommerce.core.order.domain.Order createCandidateOrder(BigDecimal retailTotal, int orderItemsToCreate, org.broadleafcommerce.core.order.domain.FulfillmentOption option)
    • createCandidateOrder

      protected org.broadleafcommerce.core.order.domain.Order createCandidateOrder(BigDecimal total, int orderItemsToCreate, String[] flatRates, int[] quantities, org.broadleafcommerce.core.order.domain.FulfillmentOption option)
      Parameters:
      total - - this number divided by the number of items to create is the value of either the weight or the price (depending on which option is being passed in) for a single order item. Note that the final price of each item will be: (total / orderItemsToCreate) * quantity
      orderItemsToCreate - - the number of order items to split the retail total across
      flatRates - - the flat rates to assign to the OrderItems that are created. To have an Order that is mixed between OrderItems and DiscreteOrderItems (which are created for flat rates) ensure that the size of this array is less than orderItemsToCreate
      quantities - - the quantities to assign to each OrderItem. If specified, this should be equal to the number of items to create
      option - - the option to associate with the flat rates
      Returns:
    • calculationResponse

      protected org.broadleafcommerce.common.money.Money calculationResponse(org.broadleafcommerce.core.order.domain.FulfillmentOption option, org.broadleafcommerce.core.order.domain.Order order) throws Exception
      Throws:
      Exception
    • createPriceBands

      protected org.broadleafcommerce.core.order.fulfillment.domain.BandedPriceFulfillmentOption createPriceBands(String[] minimumAmounts, String[] resultAmounts, org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType[] resultAmountTypes)
      Creates price bands with the given minimum amounts, results and result types. All of the lists should be the same size
      Parameters:
      minimumAmounts -
      resultAmounts -
      resultAmountTypes -
      Returns:
    • createWeightBands

      protected org.broadleafcommerce.core.order.fulfillment.domain.BandedWeightFulfillmentOption createWeightBands(String[] minimumAmounts, String[] resultAmounts, org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType[] resultAmountTypes)