### Question:
XDateRangeUtils { public XDateRange getDateRange(XSettings xsettings) { if (xsettings.getRange() instanceof XDateRange) { return (XDateRange)xsettings.getRange(); } return null; }  XDateRange getDateRange(XSettings xsettings); LocalDate generateEndDate(LocalDate startDate, Period period);  }### Answer:
@Test public void getDateRange_NO_DATE_RANGE() { XSettings xsettings = new XSettings(); xsettings.setRange(mock(XRange.class)); assertNull(utils.getDateRange(xsettings)); }
@Test public void getDateRange() { XSettings xsettings = new XSettings(); XDateRange xrange = new XDateRange(new LocalDate(2012, 10, 1), new LocalDate(2013, 10, 2), new Period(1, PeriodUnit.DAY)); xsettings.setRange(xrange); XDateRange dateRange = utils.getDateRange(xsettings); assertNotNull(dateRange); assertTrue(dateRange == xrange); }