### Question:
HoursPeriod { public boolean inPeriod(Date date){ Calendar cal = Calendar.getInstance(); cal.setTime(date); int nbMinutes=cal.get(Calendar.HOUR_OF_DAY)*60+cal.get(Calendar.MINUTE); return nbMinutes>begining&& nbMinutes<ending ; } HoursPeriod(int begining,int ending); boolean inPeriod(Date date); String toString(); boolean equals(Object p);  }### Answer:
@Test public void inPeriodTest() throws ParseException{ HoursPeriod p1=new HoursPeriod(600, 1080); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH:mm"); Date date1=format.parse("2012-08-21_04:01"); Date date2=format.parse("2012-08-21_10:01"); assertFalse(p1.inPeriod(date1)); assertTrue(p1.inPeriod(date2)); }