@Test public void testSkipDatesExclusionsNoneOf() throws Exception { final CarrierSla sla = this.context.mock(CarrierSla.class, "sla"); context.checking(new Expectations() {{ allowing(sla).getExcludeWeekDays(); will(returnValue("")); }}); ; assertEquals("2017-02-07", DateUtils.formatSD( new DeliveryTimeEstimationVisitorDefaultImpl(null, null).skipDatesExclusions(sla, DateUtils.ldParseSDT("2017-02-07"), Collections.<LocalDate, LocalDate>emptyMap()) )); this.context.assertIsSatisfied(); }
protected LocalDate skipDatesExclusions(final CarrierSla sla, final LocalDate startDate, final Map<LocalDate, LocalDate> exclusions) { LocalDate thisDate = startDate; if (!exclusions.isEmpty()) { final TreeSet<LocalDate> startDates = new TreeSet<>(exclusions.keySet()); while (true) { final LocalDate beforeOrEqual = startDates.floor(thisDate); if (beforeOrEqual == null) { return thisDate; } else if (beforeOrEqual.isBefore(thisDate)) { final LocalDate rangeEnd = exclusions.get(beforeOrEqual); if (thisDate.isAfter(rangeEnd)) { return thisDate; } else { thisDate = skipWeekdayExclusions(sla, rangeEnd.plusDays(1L)); } } else { thisDate = skipWeekdayExclusions(sla, thisDate.plusDays(1L)); } } } return thisDate; }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipDatesExclusions(final CarrierSla sla, final LocalDate startDate, final Map<LocalDate, LocalDate> exclusions) { LocalDate thisDate = startDate; if (!exclusions.isEmpty()) { final TreeSet<LocalDate> startDates = new TreeSet<>(exclusions.keySet()); while (true) { final LocalDate beforeOrEqual = startDates.floor(thisDate); if (beforeOrEqual == null) { return thisDate; } else if (beforeOrEqual.isBefore(thisDate)) { final LocalDate rangeEnd = exclusions.get(beforeOrEqual); if (thisDate.isAfter(rangeEnd)) { return thisDate; } else { thisDate = skipWeekdayExclusions(sla, rangeEnd.plusDays(1L)); } } else { thisDate = skipWeekdayExclusions(sla, thisDate.plusDays(1L)); } } } return thisDate; } }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipDatesExclusions(final CarrierSla sla, final LocalDate startDate, final Map<LocalDate, LocalDate> exclusions) { LocalDate thisDate = startDate; if (!exclusions.isEmpty()) { final TreeSet<LocalDate> startDates = new TreeSet<>(exclusions.keySet()); while (true) { final LocalDate beforeOrEqual = startDates.floor(thisDate); if (beforeOrEqual == null) { return thisDate; } else if (beforeOrEqual.isBefore(thisDate)) { final LocalDate rangeEnd = exclusions.get(beforeOrEqual); if (thisDate.isAfter(rangeEnd)) { return thisDate; } else { thisDate = skipWeekdayExclusions(sla, rangeEnd.plusDays(1L)); } } else { thisDate = skipWeekdayExclusions(sla, thisDate.plusDays(1L)); } } } return thisDate; } DeliveryTimeEstimationVisitorDefaultImpl(final WarehouseService warehouseService,
                                                    final CarrierSlaService carrierSlaService); }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipDatesExclusions(final CarrierSla sla, final LocalDate startDate, final Map<LocalDate, LocalDate> exclusions) { LocalDate thisDate = startDate; if (!exclusions.isEmpty()) { final TreeSet<LocalDate> startDates = new TreeSet<>(exclusions.keySet()); while (true) { final LocalDate beforeOrEqual = startDates.floor(thisDate); if (beforeOrEqual == null) { return thisDate; } else if (beforeOrEqual.isBefore(thisDate)) { final LocalDate rangeEnd = exclusions.get(beforeOrEqual); if (thisDate.isAfter(rangeEnd)) { return thisDate; } else { thisDate = skipWeekdayExclusions(sla, rangeEnd.plusDays(1L)); } } else { thisDate = skipWeekdayExclusions(sla, thisDate.plusDays(1L)); } } } return thisDate; } 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 { protected LocalDate skipDatesExclusions(final CarrierSla sla, final LocalDate startDate, final Map<LocalDate, LocalDate> exclusions) { LocalDate thisDate = startDate; if (!exclusions.isEmpty()) { final TreeSet<LocalDate> startDates = new TreeSet<>(exclusions.keySet()); while (true) { final LocalDate beforeOrEqual = startDates.floor(thisDate); if (beforeOrEqual == null) { return thisDate; } else if (beforeOrEqual.isBefore(thisDate)) { final LocalDate rangeEnd = exclusions.get(beforeOrEqual); if (thisDate.isAfter(rangeEnd)) { return thisDate; } else { thisDate = skipWeekdayExclusions(sla, rangeEnd.plusDays(1L)); } } else { thisDate = skipWeekdayExclusions(sla, thisDate.plusDays(1L)); } } } return thisDate; } 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);  }