### Question:
BasicMonthViewUI extends MonthViewUI { @Override public Date getDayAtLocation(int x, int y) { Point dayInGrid = getDayGridPositionAtLocation(x, y); if ((dayInGrid == null) || (dayInGrid.y == DAY_HEADER_ROW)) return null; if (dayInGrid.x == WEEK_HEADER_COLUMN) { Date month = getMonthAtLocation(x, y); return getLastDayInWeek(month, dayInGrid.y, dayInGrid.x); } Date month = getMonthAtLocation(x, y); return getDayInMonth(month, dayInGrid.y, dayInGrid.x); }  @SuppressWarnings({ "UnusedDeclaration" }) static ComponentUI createUI(JComponent c); @Override void installUI(JComponent c); @Override void uninstallUI(JComponent c); @Override String[] getDaysOfTheWeek(); boolean isUsingKeyboard(); void setUsingKeyboard(boolean val); @Override Date getDayAtLocation(int x, int y); boolean isWeekOfYearCell(int x, int y); @Override void update(Graphics g, JComponent c); @Override void paint(Graphics g, JComponent c); @Override Date getLastDisplayedDay(); static final int MONTH_DOWN; static final int MONTH_UP; }### Answer:
@Test public void testGetDayAtLocation() { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run test - headless environment"); return; } JXMonthView monthView = new JXMonthView(); monthView.getSelectionModel().setMinimalDaysInFirstWeek(1); JXFrame frame = new JXFrame(); frame.add(monthView); frame.pack(); Dimension pref = monthView.getPreferredSize(); pref.width = pref.width / 2; pref.height = pref.height / 2; Date date = monthView.getDayAtLocation(pref.width, pref.height); assertNotNull(date); }