Class NoRestrictionsStrategyTest

java.lang.Object
de.hybris.platform.warehousing.sourcing.strategy.impl.NoRestrictionsStrategyTest

@UnitTest public class NoRestrictionsStrategyTest extends Object
  • Constructor Details

    • NoRestrictionsStrategyTest

      public NoRestrictionsStrategyTest()
  • Method Details

    • setup

      public void setup()
    • testSourcingNoRestriction1Location

      public void testSourcingNoRestriction1Location()
      Given an order with 2 entries:
      entry 1 : {quantity: 10, product: PROPANE_BARBECUE}
      entry 2 : {quantity: 20, product: CHARCOAL_BARBECUE}

      Result:
      It should source complete from 1 location
      {Warehouse: RECIFE, Availability : {[PROPANE_BARBECUE,10], [CHARCOAL_BARBECUE,20}}

      Assert:
      It verifies the number of SourcingResult
      It verifies the PointOfServiceModel where the order entries were sourced
      It checks if the source is completed.

    • testSourcingNoRestrictionSplit2Location

      public void testSourcingNoRestrictionSplit2Location()
      Given an order with 2 entries:
      entry 1 : {quantity: 10, product: PROPANE_BARBECUE}
      entry 2 : {quantity: 20, product: CHARCOAL_BARBECUE}

      Result:
      It should source PROPANE_BARBECUE from 2 locations
      {Warehouse: RECIFE, Availability : {[PROPANE_BARBECUE,5], [CHARCOAL_BARBECUE,20}}
      {Warehouse: OLINDA, Availability : {[PROPANE_BARBECUE,5]}

      Assert:
      It verifies the number of SourcingResult
      It verifies the PointOfServiceModel where the order entries were sourced
      It checks if the source is completed.

    • testSourceCompleteFrom3Locations

      public void testSourceCompleteFrom3Locations()
      Given an order with 2 entries:
      entry 1 : {quantity: 10, product: PROPANE_BARBECUE}
      entry 2 : {quantity: 20, product: CHARCOAL_BARBECUE}

      Result:
      It should source PROPANE_BARBECUE from 3 locations
      {Warehouse: RECIFE, Availability : {[PROPANE_BARBECUE,5], [CHARCOAL_BARBECUE,20}}
      {Warehouse: OLINDA, Availability : {[PROPANE_BARBECUE,3]}
      {Warehouse: PAULISTA, Availability : {[PROPANE_BARBECUE,2]}

      Assert:
      It verifies the number of SourcingResult
      It verifies the PointOfServiceModel where the order entries were sourced
      It checks if the source is completed.

    • testNothingSourced

      public void testNothingSourced()
      Given an order with 2 entries:
      entry 1 : {quantity: 10, product: PROPANE_BARBECUE}
      entry 2 : {quantity: 20, product: CHARCOAL_BARBECUE}

      Result: It should not source. There is not enough stock for both entries
      {Warehouse: RECIFE, Availability : {[PROPANE_BARBECUE,0]}
      {Warehouse: OLINDA, Availability : {[CHARCOAL_BARBECUE,0]}

      Assert:
      It verifies the number of SourcingResult
      It verifies the PointOfServiceModel where the order entries were sourced
      It checks if the source is completed.

    • testPartiallySourced

      public void testPartiallySourced()
      Given an order with 2 entries:
      entry 1 : {quantity: 10, product: PROPANE_BARBECUE}
      entry 2 : {quantity: 20, product: CHARCOAL_BARBECUE}

      Result: It should not source - not enough stock for PROPANE_BARBECUE
      SourcingResult
      {Warehouse: RECIFE, Availability : {[PROPANE_BARBECUE,5]}
      {Warehouse: OLINDA, Availability : {[CHARCOAL_BARBECUE,20]}

      Assert:
      It verifies the number of SourcingResult
      It verifies the PointOfServiceModel where the order entries were sourced
      It checks if the source is completed. It verifies the quantity sourced for each entry.

    • shouldFail_nullContext

      public void shouldFail_nullContext()
    • assertEqualQuantity

      protected void assertEqualQuantity(SourcingContext context, long qtyExpected, ProductModel product, String posName)
    • assertEqualsQuantityAllocation

      protected void assertEqualsQuantityAllocation(Set<SourcingResult> results, String pos, int qtyExpected)