ManageStartEndTime extends TimerTask { private ManageStartEndTime() { endDate = new Date(); startDate = DateUtils.addHours(endDate, -1); } private  ManageStartEndTime(); static void manage(); @Override synchronized void run(); static synchronized Date[] getStartEndTime();  }
@Test public void testManageStartEndTime() { ManageStartEndTime.manage(); Date[] range = ManageStartEndTime.getStartEndTime(); Assert.assertEquals(range[1].getTime() - range[0].getTime(), 60*60*1000); }