|
17 | 17 | * limitations under the License.
|
18 | 18 | * #L%
|
19 | 19 | */
|
| 20 | +/** |
| 21 | + * @author Austin Rooke (austinrooke) |
| 22 | + */ |
20 | 23 | package org.broadleafcommerce.core.spec.pricing.service.workflow
|
21 | 24 |
|
22 | 25 | import org.broadleafcommerce.common.money.Money
|
23 |
| -import org.broadleafcommerce.core.catalog.domain.Sku |
24 |
| -import org.broadleafcommerce.core.catalog.domain.SkuFee |
25 | 26 | import org.broadleafcommerce.core.catalog.domain.SkuFeeImpl
|
26 | 27 | import org.broadleafcommerce.core.catalog.domain.SkuImpl
|
27 | 28 | import org.broadleafcommerce.core.catalog.service.type.SkuFeeType
|
28 |
| -import org.broadleafcommerce.core.order.domain.BundleOrderItem |
29 | 29 | import org.broadleafcommerce.core.order.domain.BundleOrderItemImpl
|
30 |
| -import org.broadleafcommerce.core.order.domain.FulfillmentGroup |
31 | 30 | import org.broadleafcommerce.core.order.domain.FulfillmentGroupFeeImpl
|
32 | 31 | import org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl
|
33 |
| -import org.broadleafcommerce.core.order.domain.FulfillmentGroupItem |
34 | 32 | import org.broadleafcommerce.core.order.domain.FulfillmentGroupItemImpl
|
35 | 33 | import org.broadleafcommerce.core.order.domain.Order
|
36 | 34 | import org.broadleafcommerce.core.order.service.FulfillmentGroupService
|
37 | 35 | import org.broadleafcommerce.core.pricing.service.workflow.ConsolidateFulfillmentFeesActivity
|
38 | 36 |
|
39 | 37 | class ConsolidateFulfillmentFeesActivitySpec extends BasePricingActivitySpec {
|
40 | 38 |
|
| 39 | + /* |
| 40 | + * The code coverage on this spec is only 69.4% due to not knowing what the format of |
| 41 | + * SkuFee expression statements are for the method shouldApplyFeeToFulfillmentGroup |
| 42 | + * to be further tested. |
| 43 | + * |
| 44 | + * If someone, whom knows this information, would like to write a test to up the code |
| 45 | + * coverage, please do so. |
| 46 | + */ |
41 | 47 | FulfillmentGroupService mockFulfillmentGroupService
|
42 | 48 | Order order
|
43 | 49 | def setup() {
|
44 | 50 | //Setup a valid FulfillmentGroup with a FulfillmentItem inside
|
45 | 51 | // and place it inside the context.seedData order object
|
46 |
| - FulfillmentGroup fulfillmentGroup = new FulfillmentGroupImpl() |
47 |
| - FulfillmentGroupItem fulfillmentGroupItem = new FulfillmentGroupItemImpl() |
48 |
| - SkuFee skuFee = new SkuFeeImpl() |
49 |
| - skuFee.feeType = SkuFeeType.FULFILLMENT |
50 |
| - skuFee.name = "Test" |
51 |
| - skuFee.taxable = true |
52 |
| - skuFee.amount = new Money(1.00) |
53 |
| - BundleOrderItem bundleOrderItem = new BundleOrderItemImpl() |
54 |
| - Sku sku = new SkuImpl() |
55 |
| - sku.id = 1 |
56 |
| - sku.retailPrice = new Money(1.00) |
57 |
| - sku.fees = new ArrayList() |
58 |
| - sku.fees.add(skuFee) |
59 |
| - bundleOrderItem.sku = sku |
60 |
| - fulfillmentGroupItem.orderItem = bundleOrderItem |
61 |
| - List<FulfillmentGroupItem> fulfillmentGroupItems = new ArrayList() |
62 |
| - fulfillmentGroupItems.add(fulfillmentGroupItem) |
63 |
| - fulfillmentGroup.fulfillmentGroupItems = fulfillmentGroupItems |
64 |
| - context.seedData.fulfillmentGroups = new ArrayList<FulfillmentGroup>() |
65 |
| - context.seedData.fulfillmentGroups.add(fulfillmentGroup) |
66 | 52 | order = context.seedData
|
| 53 | + context.seedData.fulfillmentGroups = [ |
| 54 | + new FulfillmentGroupImpl().with() { |
| 55 | + fulfillmentGroupItems = [ |
| 56 | + new FulfillmentGroupItemImpl().with() { |
| 57 | + orderItem = new BundleOrderItemImpl().with() { |
| 58 | + sku = new SkuImpl().with() { |
| 59 | + id = 1 |
| 60 | + retailPrice = new Money('1.00') |
| 61 | + fees = [ |
| 62 | + new SkuFeeImpl().with() { |
| 63 | + feeType = SkuFeeType.FULFILLMENT |
| 64 | + name = 'Test' |
| 65 | + taxable = true |
| 66 | + amount = new Money('1.00') |
| 67 | + it |
| 68 | + } |
| 69 | + ] as List |
| 70 | + it |
| 71 | + } |
| 72 | + it |
| 73 | + } |
| 74 | + it |
| 75 | + } |
| 76 | + ] |
| 77 | + it |
| 78 | + } |
| 79 | + ] |
67 | 80 | }
|
68 | 81 |
|
69 | 82 | def "Test a valid run with valid data"() {
|
|
0 commit comments