@Test public void testDoAdapterWithAllMonths() throws Exception { Customer customer = getCustomerByFile(super.FILE_INPUT_MONTHS); assertEquals(MonthEnum.values().length, customer.getReservations().size()); // The order of MonthEnum must bem the same that of the file. Iterator<DateReservation> iterator = customer.getReservations().iterator(); for (MonthEnum month : MonthEnum.values()) { if (iterator.hasNext()) { MonthEnum monthEnum = iterator.next().getMoth(); assertEquals(month, monthEnum); } else { fail(); } } }
@Test public void testDoAdapterWithAllWeekDays() throws Exception { Customer customer = getCustomerByFile(super.FILE_INPUT_WEEK_DAYS); // The order of WeekDayEnum must bem the same that of the file. Iterator<DateReservation> iterator = customer.getReservations().iterator(); for (WeekDayEnum weekDay : WeekDayEnum.values()) { // ignore days not present on file if (weekDay.equals(WeekDayEnum.WEEKDAY) || weekDay.equals(WeekDayEnum.WEEKEND)) { continue; } if (iterator.hasNext()) { WeekDayEnum weekDay1 = iterator.next().getWeekDay(); assertEquals(weekDay, weekDay1); } else { fail(); } } }