### Question:
WeeklyTimeWindow { public boolean isDateInTimeWindow(Date asOf,TimeZone tz){ Calendar cal = Calendar.getInstance(tz); cal.setTime(asOf); DayOfWeek currentDay = DayOfWeek.from(cal); TimeOfDay currentTime = new TimeOfDay(cal); long windowStartTime = millisIntoWeek(startDay, startTime); long windowEndTime = windowStartTime+durationTimeUnit.toMillis(duration); long checkDateIntoWeek = millisIntoWeek(currentDay, currentTime); return (checkDateIntoWeek >= windowStartTime) && (checkDateIntoWeek < windowEndTime); } WeeklyTimeWindow(DayOfWeek startDay,String startTime, int duration, TimeUnit timeUnit);  WeeklyTimeWindow(DayOfWeek startDay,TimeOfDay startTime, int duration, TimeUnit timeUnit);  WeeklyTimeWindow(TimeWindow timeWindow); boolean isDateInTimeWindow(Date asOf,TimeZone tz); Date nextOrCurrentStartDate(Date asOf,TimeZone tz); Date thisWeekStartDate(Date asOf,TimeZone tz); Date nextWeekStartDate(Date asOf,TimeZone tz); static Date calculateEndDate(Date startDate,TimeWindow timeWindow); Date calculateEndDate(Date startDate); static WeeklyTimeWindow nextOrCurrentWindow(List<WeeklyTimeWindow>windows, Date asOfDate,TimeZone tz); static List<WeeklyTimeWindow> sortByStartTime(List<WeeklyTimeWindow>windows,Date asOfDate,TimeZone tz); static List<WeeklyTimeWindow> fromTimeWindowDataListSorted(List<Map<String,Object>>windowAttributes,Calendar cal); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testFallsWithin() throws Exception{ WeeklyTimeWindow window = new WeeklyTimeWindow(DayOfWeek.THURSDAY, "10:00:00", 60, TimeUnit.MINUTES); Date begin = simulateDateWithCST("2016-01-21T10:00:00"); assertTrue(window.isDateInTimeWindow(begin,CST)); Date end = simulateDateWithCST("2016-01-21T10:59:59"); assertTrue(window.isDateInTimeWindow(end,CST)); }
@Test public void testFallsOutside() throws Exception{ WeeklyTimeWindow window = new WeeklyTimeWindow(DayOfWeek.THURSDAY, "10:00:00", 60,TimeUnit.MINUTES); Date testDate2 = simulateDateWithCST("2016-01-21T11:00:00"); assertFalse(window.isDateInTimeWindow(testDate2,CST)); }
@Test public void testFallsInsideMultiDay() throws Exception{ WeeklyTimeWindow window = new WeeklyTimeWindow(DayOfWeek.THURSDAY, "10:00:00", 3,TimeUnit.DAYS); Date testDate2 = simulateDateWithCST("2016-01-23T10:00:00"); assertTrue(window.isDateInTimeWindow(testDate2,CST)); }