@Test public void testSkipWeekdayExclusionsNoneOf() throws Exception { final CarrierSla sla = this.context.mock(CarrierSla.class, "sla"); final LocalDate calendar = DateUtils.ldParseSDT("2017-02-07"); context.checking(new Expectations() {{ allowing(sla).getExcludeWeekDaysAsList(); will(returnValue(Collections.emptyList())); }}); new DeliveryTimeEstimationVisitorDefaultImpl(null, null).skipWeekdayExclusions(sla, calendar); assertEquals("2017-02-07", DateUtils.formatSD(calendar)); this.context.assertIsSatisfied(); }
protected LocalDate skipWeekdayExclusions(final CarrierSla sla, final LocalDate date) { LocalDate thisDate = date; final List<Integer> skip = sla.getExcludeWeekDaysAsList(); if (!skip.isEmpty()) { final List<DayOfWeek> excluded = new ArrayList<>(DateUtils.fromCalendarDaysOfWeekToISO(skip)); while (!excluded.isEmpty()) { final DayOfWeek dayOfWeek = thisDate.getDayOfWeek(); final Iterator<DayOfWeek> itExcluded = excluded.iterator(); boolean removed = false; while (itExcluded.hasNext()) { if (dayOfWeek == itExcluded.next()) { thisDate = thisDate.plusDays(1); itExcluded.remove(); removed = true; } } if (!removed) { return thisDate; } } } return thisDate; }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipWeekdayExclusions(final CarrierSla sla, final LocalDate date) { LocalDate thisDate = date; final List<Integer> skip = sla.getExcludeWeekDaysAsList(); if (!skip.isEmpty()) { final List<DayOfWeek> excluded = new ArrayList<>(DateUtils.fromCalendarDaysOfWeekToISO(skip)); while (!excluded.isEmpty()) { final DayOfWeek dayOfWeek = thisDate.getDayOfWeek(); final Iterator<DayOfWeek> itExcluded = excluded.iterator(); boolean removed = false; while (itExcluded.hasNext()) { if (dayOfWeek == itExcluded.next()) { thisDate = thisDate.plusDays(1); itExcluded.remove(); removed = true; } } if (!removed) { return thisDate; } } } return thisDate; } }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipWeekdayExclusions(final CarrierSla sla, final LocalDate date) { LocalDate thisDate = date; final List<Integer> skip = sla.getExcludeWeekDaysAsList(); if (!skip.isEmpty()) { final List<DayOfWeek> excluded = new ArrayList<>(DateUtils.fromCalendarDaysOfWeekToISO(skip)); while (!excluded.isEmpty()) { final DayOfWeek dayOfWeek = thisDate.getDayOfWeek(); final Iterator<DayOfWeek> itExcluded = excluded.iterator(); boolean removed = false; while (itExcluded.hasNext()) { if (dayOfWeek == itExcluded.next()) { thisDate = thisDate.plusDays(1); itExcluded.remove(); removed = true; } } if (!removed) { return thisDate; } } } return thisDate; } DeliveryTimeEstimationVisitorDefaultImpl(final WarehouseService warehouseService,
                                                    final CarrierSlaService carrierSlaService); }
DeliveryTimeEstimationVisitorDefaultImpl implements DeliveryTimeEstimationVisitor, Configuration { protected LocalDate skipWeekdayExclusions(final CarrierSla sla, final LocalDate date) { LocalDate thisDate = date; final List<Integer> skip = sla.getExcludeWeekDaysAsList(); if (!skip.isEmpty()) { final List<DayOfWeek> excluded = new ArrayList<>(DateUtils.fromCalendarDaysOfWeekToISO(skip)); while (!excluded.isEmpty()) { final DayOfWeek dayOfWeek = thisDate.getDayOfWeek(); final Iterator<DayOfWeek> itExcluded = excluded.iterator(); boolean removed = false; while (itExcluded.hasNext()) { if (dayOfWeek == itExcluded.next()) { thisDate = thisDate.plusDays(1); itExcluded.remove(); removed = true; } } if (!removed) { return thisDate; } } } 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 skipWeekdayExclusions(final CarrierSla sla, final LocalDate date) { LocalDate thisDate = date; final List<Integer> skip = sla.getExcludeWeekDaysAsList(); if (!skip.isEmpty()) { final List<DayOfWeek> excluded = new ArrayList<>(DateUtils.fromCalendarDaysOfWeekToISO(skip)); while (!excluded.isEmpty()) { final DayOfWeek dayOfWeek = thisDate.getDayOfWeek(); final Iterator<DayOfWeek> itExcluded = excluded.iterator(); boolean removed = false; while (itExcluded.hasNext()) { if (dayOfWeek == itExcluded.next()) { thisDate = thisDate.plusDays(1); itExcluded.remove(); removed = true; } } if (!removed) { return thisDate; } } } 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);  }