DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected Map<LocalDate, LocalDate> getCarrierSlaExcludedDates(final CarrierSla sla) { return sla.getExcludeDatesAsMap(); } 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);  }
@Test public void testGetCarrierSlaExcludedDatesNoneOf() throws Exception { final CarrierSlaEntity sla = new CarrierSlaEntity(); sla.setExcludeDates(""); final Map<LocalDate, LocalDate> dates = new DeliveryTimeEstimationVisitorDefaultImpl(null, null).getCarrierSlaExcludedDates(sla); assertNotNull(dates); assertTrue(dates.isEmpty()); }
@Test public void testGetCarrierSlaExcludedDates() throws Exception { final CarrierSlaEntity sla = new CarrierSlaEntity(); sla.setExcludeDates("2017-01-08,2017-01-10:2017-01-15,2017-01-17"); LocalDate date, date2; final Map<LocalDate, LocalDate> dates = new DeliveryTimeEstimationVisitorDefaultImpl(null, null).getCarrierSlaExcludedDates(sla); assertNotNull(dates); assertEquals(3, dates.size()); date = DateUtils.ldParseSDT("2017-01-08"); assertEquals(date, dates.get(date)); date = DateUtils.ldParseSDT("2017-01-10"); date2 = DateUtils.ldParseSDT("2017-01-15"); assertEquals(date2, dates.get(date)); date = DateUtils.ldParseSDT("2017-01-17"); assertEquals(date, dates.get(date)); }