DateRangeAndType { public static DateRangeAndType fromString(final String dateRange) { Preconditions.checkNotNull(dateRange, "DateRange cannot be null."); Preconditions.checkArgument(!dateRange.isEmpty(), "DateRange cannot be empty."); return dateRange.contains(",") ? parseCustomFormat(dateRange) : parseEnumFormat(dateRange); } private  DateRangeAndType(
      LocalDate startDate, LocalDate endDate, ReportDefinitionDateRangeType type); String getStartDateStr(); String getEndDateStr(); String getTypeStr(); LocalDate getStartDate(); LocalDate getEndDate(); ReportDefinitionDateRangeType getType(); DateRange getDateRange(); static DateRangeAndType fromValues(LocalDate startDate, LocalDate endDate,
      ReportDefinitionDateRangeType type); static DateRangeAndType fromString(final String dateRange);  }
@Test public void testLast14DayRange() { DateRangeAndType last14Days = DateRangeAndType.fromString("LAST_14_DAYS"); testDateRange(last14Days, "20130918", "20131001"); }
@Test public void testLast30DayRange() { DateRangeAndType last30Days = DateRangeAndType.fromString("LAST_30_DAYS"); testDateRange(last30Days, "20130902", "20131001"); }
@Test public void testLast7DayRange() { DateRangeAndType last7Days = DateRangeAndType.fromString("LAST_7_DAYS"); testDateRange(last7Days, "20130925", "20131001"); }
@Test public void testLastMonthRange() { DateRangeAndType lastMonth = DateRangeAndType.fromString("LAST_MONTH"); testDateRange(lastMonth, "20130901", "20130930"); }
@Test public void testLastWeekRange() { DateRangeAndType lastWeek = DateRangeAndType.fromString("LAST_WEEK"); testDateRange(lastWeek, "20130923", "20130929"); }
@Test public void testThisMonthRange() { DateRangeAndType thisMonth = DateRangeAndType.fromString("THIS_MONTH"); testDateRange(thisMonth, "20131001", "20131031"); }
@Test public void testTodayRange() { DateRangeAndType today = DateRangeAndType.fromString("TODAY"); testDateRange(today, "20131002", "20131002"); }
@Test public void testYesterdayRange() { DateRangeAndType thisMonth = DateRangeAndType.fromString("YESTERDAY"); testDateRange(thisMonth, "20131001", "20131001"); }
@Test public void testCustomRange() { DateRangeAndType custom = DateRangeAndType.fromString("20131001,20131005"); testDateRange(custom, "20131001", "20131005"); }
@Test(expected = NullPointerException.class) public void testNullRange() { DateRangeAndType.fromString(null); }
@Test(expected = IllegalArgumentException.class) public void testEmptyRange() { DateRangeAndType.fromString(""); }
@Test(expected = IllegalArgumentException.class) public void testInvalidRange() { DateRangeAndType.fromString("INVALID_RANGE"); }
@Test(expected = IllegalArgumentException.class) public void testCustomRangeOneDate() { DateRangeAndType.fromString("20131002"); }
@Test(expected = IllegalArgumentException.class) public void testCustomRangeBadFormat() { DateRangeAndType.fromString("2013-10-02,2013-10-05"); }
@Test public void testCustomRangeSameDay() { DateRangeAndType custom = DateRangeAndType.fromString("20131001,20131001"); testDateRange(custom, "20131001", "20131001"); }
@Test(expected = IllegalArgumentException.class) public void testCustomInvalidOrder() { DateRangeAndType.fromString("20131005,20131001"); }