OpeningHoursInterval { public int getNumberOfDays() { if (mEndDay == sNoEndDay) { return 1; } return (mEndDay - mStartDay) + 1; } OpeningHoursInterval(int startDay, int endDay, String openingHours);  OpeningHoursInterval(int startDay, String openingHours); int getStartDay(); void setStartDay(int startDay); int getEndDay(); void setEndDay(int endDay); String getOpeningHours(); void setOpeningHours(String openingHours); int getNumberOfDays(); boolean isDateInInterval(Date date); static final String CLOSED; }
@Test public void testNumberOfDays() throws Exception { OpeningHoursInterval interval = new OpeningHoursInterval(5, 6, "9 - 10"); assertEquals(2,interval.getNumberOfDays()); interval = new OpeningHoursInterval(0, 6, "9 - 10"); assertEquals(7,interval.getNumberOfDays()); interval = new OpeningHoursInterval(0, "9 - 10"); assertEquals(1,interval.getNumberOfDays()); }