@Test public void convert() { String value = "2010-12-07T00:00:00Z"; XDateRange range = mock(XDateRange.class); Period period = new Period(1, PeriodUnit.MONTH); when(range.getGap()).thenReturn(period); LocalDate startDate = new LocalDate(2010, 12, 7); LocalDate endDate = new LocalDate(2011, 1, 6); when(xDateRangeUtils.getDateRange(xsettings)).thenReturn(range); when(xDateRangeUtils.generateEndDate(startDate, period)).thenReturn(endDate); assertEquals(new DayPeriod(new SimpleLocalDate(2010, 12, 7), new SimpleLocalDate(2011, 1, 6)), converter.convert(value, xsettings)); }
@Override public DayPeriod convert(String value, XSettings xsettings) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(xsettings); LocalDate startDate = SearchDateTimeUtils.convertISOStringToDate(value); Period period = xdateRangeUtils.getDateRange(xsettings).getGap(); LocalDate endDate = xdateRangeUtils.generateEndDate(startDate, period); return new DayPeriod(new SimpleLocalDate(startDate), new SimpleLocalDate(endDate)); }
FacetDayPeriodValueConverter implements FacetValueConverter { @Override public DayPeriod convert(String value, XSettings xsettings) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(xsettings); LocalDate startDate = SearchDateTimeUtils.convertISOStringToDate(value); Period period = xdateRangeUtils.getDateRange(xsettings).getGap(); LocalDate endDate = xdateRangeUtils.generateEndDate(startDate, period); return new DayPeriod(new SimpleLocalDate(startDate), new SimpleLocalDate(endDate)); } }
FacetDayPeriodValueConverter implements FacetValueConverter { @Override public DayPeriod convert(String value, XSettings xsettings) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(xsettings); LocalDate startDate = SearchDateTimeUtils.convertISOStringToDate(value); Period period = xdateRangeUtils.getDateRange(xsettings).getGap(); LocalDate endDate = xdateRangeUtils.generateEndDate(startDate, period); return new DayPeriod(new SimpleLocalDate(startDate), new SimpleLocalDate(endDate)); }  }
FacetDayPeriodValueConverter implements FacetValueConverter { @Override public DayPeriod convert(String value, XSettings xsettings) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(xsettings); LocalDate startDate = SearchDateTimeUtils.convertISOStringToDate(value); Period period = xdateRangeUtils.getDateRange(xsettings).getGap(); LocalDate endDate = xdateRangeUtils.generateEndDate(startDate, period); return new DayPeriod(new SimpleLocalDate(startDate), new SimpleLocalDate(endDate)); }  @Override DayPeriod convert(String value, XSettings xsettings); @Override boolean handles(XSettings xsettings); @Autowired void setXdateRangeUtils(XDateRangeUtils xdateRangeUtils); }
FacetDayPeriodValueConverter implements FacetValueConverter { @Override public DayPeriod convert(String value, XSettings xsettings) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(xsettings); LocalDate startDate = SearchDateTimeUtils.convertISOStringToDate(value); Period period = xdateRangeUtils.getDateRange(xsettings).getGap(); LocalDate endDate = xdateRangeUtils.generateEndDate(startDate, period); return new DayPeriod(new SimpleLocalDate(startDate), new SimpleLocalDate(endDate)); }  @Override DayPeriod convert(String value, XSettings xsettings); @Override boolean handles(XSettings xsettings); @Autowired void setXdateRangeUtils(XDateRangeUtils xdateRangeUtils);  }