@Test public void testDeliveryTimeFullGuaranteedNoFf() throws Exception { final WarehouseService warehouseService = this.context.mock(WarehouseService.class, "warehouseService"); final Shop shop = this.context.mock(Shop.class, "shop"); final Warehouse warehouse = this.context.mock(Warehouse.class, "warehouse"); final CustomerOrder order = this.context.mock(CustomerOrder.class, "order"); final CustomerOrderDelivery delivery = this.context.mock(CustomerOrderDelivery.class, "delivery"); final CustomerOrderDeliveryDet det = this.context.mock(CustomerOrderDeliveryDet.class, "det"); final CarrierSlaEntity sla = new CarrierSlaEntity(); sla.setExcludeDates("2017-02-08,2017-02-10:2017-02-15,2017-02-17"); sla.setExcludeWeekDays("1,5"); sla.setGuaranteed(true); sla.setMinDays(1); sla.setMaxDays(5); final LocalDate calendar = DateUtils.ldParseSDT("2017-02-07"); final DeliveryTimeEstimationVisitorDefaultImpl visitor = new DeliveryTimeEstimationVisitorDefaultImpl(warehouseService, null) { @Override protected LocalDate now() { return calendar; } }; context.checking(new Expectations() {{ allowing(delivery).getCustomerOrder(); will(returnValue(order)); allowing(delivery).getCarrierSla(); will(returnValue(sla)); allowing(order).getShop(); will(returnValue(shop)); allowing(shop).getShopId(); will(returnValue(123L)); allowing(warehouseService).getByShopIdMapped(123L, false); will(returnValue(Collections.singletonMap("ABC", warehouse))); allowing(delivery).getDeliveryGroup(); will(returnValue(CustomerOrderDelivery.STANDARD_DELIVERY_GROUP)); allowing(delivery).getDetail(); will(returnValue(Collections.singleton(det))); allowing(det).getSupplierCode(); will(returnValue("CED")); oneOf(delivery).setDeliveryGuaranteed(with(equal(DateUtils.ldtParseSDT("2017-02-18")))); oneOf(delivery).setDeliveryEstimatedMin(null); oneOf(delivery).setDeliveryEstimatedMax(null); }}); visitor.visit(delivery); this.context.assertIsSatisfied(); }
@Override public void visit(final CustomerOrder order) { final Collection<CustomerOrderDelivery> deliveries = order.getDelivery(); if (CollectionUtils.isNotEmpty(deliveries)) { final Map<String, Warehouse> warehouseByCode = getFulfilmentCentresMap(order); for (final CustomerOrderDelivery delivery : deliveries) { determineDeliveryTime(delivery, warehouseByCode); } } }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { @Override public void visit(final CustomerOrder order) { final Collection<CustomerOrderDelivery> deliveries = order.getDelivery(); if (CollectionUtils.isNotEmpty(deliveries)) { final Map<String, Warehouse> warehouseByCode = getFulfilmentCentresMap(order); for (final CustomerOrderDelivery delivery : deliveries) { determineDeliveryTime(delivery, warehouseByCode); } } } }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { @Override public void visit(final CustomerOrder order) { final Collection<CustomerOrderDelivery> deliveries = order.getDelivery(); if (CollectionUtils.isNotEmpty(deliveries)) { final Map<String, Warehouse> warehouseByCode = getFulfilmentCentresMap(order); for (final CustomerOrderDelivery delivery : deliveries) { determineDeliveryTime(delivery, warehouseByCode); } } } DeliveryTimeEstimationVisitorDefaultImpl(final WarehouseService warehouseService,
                                                    final CarrierSlaService carrierSlaService); }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { @Override public void visit(final CustomerOrder order) { final Collection<CustomerOrderDelivery> deliveries = order.getDelivery(); if (CollectionUtils.isNotEmpty(deliveries)) { final Map<String, Warehouse> warehouseByCode = getFulfilmentCentresMap(order); for (final CustomerOrderDelivery delivery : deliveries) { determineDeliveryTime(delivery, warehouseByCode); } } } DeliveryTimeEstimationVisitorDefaultImpl(final WarehouseService warehouseService,
                                                    final CarrierSlaService carrierSlaService); @Override void visit(final CustomerOrder order); @Override void visit(final CustomerOrderDelivery delivery); @Override void visit(final MutableShoppingCart shoppingCart); @Override ConfigurationContext getCfgContext(); void setCfgContext(final ConfigurationContext cfgContext); }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { @Override public void visit(final CustomerOrder order) { final Collection<CustomerOrderDelivery> deliveries = order.getDelivery(); if (CollectionUtils.isNotEmpty(deliveries)) { final Map<String, Warehouse> warehouseByCode = getFulfilmentCentresMap(order); for (final CustomerOrderDelivery delivery : deliveries) { determineDeliveryTime(delivery, warehouseByCode); } } } DeliveryTimeEstimationVisitorDefaultImpl(final WarehouseService warehouseService,
                                                    final CarrierSlaService carrierSlaService); @Override void visit(final CustomerOrder order); @Override void visit(final CustomerOrderDelivery delivery); @Override void visit(final MutableShoppingCart shoppingCart); @Override ConfigurationContext getCfgContext(); void setCfgContext(final ConfigurationContext cfgContext);  }