DaySelectionModel extends AbstractDateSelectionModel { @Override public void addSelectionInterval(Date startDate, Date endDate) { if (startDate.after(endDate)) { return; } startDate = startOfDay(startDate); endDate = startOfDay(endDate); boolean added = false; switch (selectionMode) { case SINGLE_SELECTION: if (isSelected(startDate)) return; clearSelectionImpl(); added = addSelectionImpl(startDate, startDate); break; case SINGLE_INTERVAL_SELECTION: if (isIntervalSelected(startDate, endDate)) return; clearSelectionImpl(); added = addSelectionImpl(startDate, endDate); break; case MULTIPLE_INTERVAL_SELECTION: if (isIntervalSelected(startDate, endDate)) return; added = addSelectionImpl(startDate, endDate); break; default: break; } if (added) { fireValueChanged(EventType.DATES_ADDED); } } 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 testAddIntervalNulls() { try { model.addSelectionInterval(null, null); fail("normalizedDate must throw NPE if date is null"); } catch (NullPointerException e) { } catch (Exception e) { fail("unexpected exception " + e); } }