DaySelectionModel extends AbstractDateSelectionModel { @Override public void setSelectionInterval(Date startDate, Date endDate) { startDate = startOfDay(startDate); endDate = startOfDay(endDate); if (SelectionMode.SINGLE_SELECTION.equals(selectionMode)) { if (isSelected(startDate)) return; endDate = startDate; } else { if (isIntervalSelected(startDate, endDate)) return; } clearSelectionImpl(); if (addSelectionImpl(startDate, endDate)) { fireValueChanged(EventType.DATES_SET); } } DaySelectionModel();  DaySelectionModel(Locale locale); @Override SelectionMode getSelectionMode(); @Override void setSelectionMode(final SelectionMode selectionMode); @Override void addSelectionInterval(Date startDate, Date endDate); @Override void setSelectionInterval(Date startDate, Date endDate); @Override void removeSelectionInterval(Date startDate, Date endDate); @Override void clearSelection(); @Override SortedSet<Date> getSelection(); @Override Date getFirstSelectionDate(); @Override Date getLastSelectionDate(); @Override boolean isSelected(Date date); @Override boolean isSelectionEmpty(); @Override SortedSet<Date> getUnselectableDates(); @Override void setUnselectableDates(SortedSet<Date> unselectables); @Override boolean isUnselectableDate(Date date); @Override Date getNormalizedDate(Date date);  }
@Test public void testSetIntervalNulls() { try { model.setSelectionInterval(null, null); fail("normalizedDate must throw NPE if date is null"); } catch (NullPointerException e) { } catch (Exception e) { fail("unexpected exception " + e); } }
@Test public void testCleanupCopyDate() { Date copy = new Date(today.getTime()); model.setSelectionInterval(today, today); assertEquals("the date used for selection must be unchanged", copy, today); }