DateRangeAndType { public static DateRangeAndType fromValues(LocalDate startDate, LocalDate endDate, ReportDefinitionDateRangeType type) { if (startDate != null && endDate != null) { return new DateRangeAndType(startDate, endDate, ReportDefinitionDateRangeType.CUSTOM_DATE); } else if (type != null && type != ReportDefinitionDateRangeType.CUSTOM_DATE) { return parseEnumFormat(type); } else { throw new IllegalArgumentException( "Must provide either: 'startDate' and 'endData', or 'type'."); } } 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 testOverritingDates() { DateRangeAndType last7Days = DateRangeAndType.fromValues(null, null, ReportDefinitionDateRangeType.LAST_7_DAYS); testDateRange(last7Days, "20130925", "20131001"); }
@Test(expected = IllegalArgumentException.class) public void testInvalidValues1() { DateRangeAndType.fromValues(null, null, null); }
@Test(expected = IllegalArgumentException.class) public void testInvalidValues2() { DateRangeAndType.fromValues(null, date, ReportDefinitionDateRangeType.CUSTOM_DATE); }