TaskHelper { public static Date tomorrowZero(Date period) { if (period == null) { period = new Date(); } Calendar cal = Calendar.getInstance(); cal.setTime(period); cal.add(Calendar.DAY_OF_YEAR, 1); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); }  static String join(double[] array, char separator); static String join(double[] array, char separator, int startIndex, int endIndex); static String join(int[] array, char separator); static String join(int[] array, char separator, int startIndex, int endIndex); static String join(Number[] array, char separator); static String join(Number[] array, char separator, int startIndex, int endIndex); static Date nextMonthStart(Date period); static Date thisHour(Date period); static Date todayZero(Date period); static Date tomorrowZero(Date period); static Date yesterdayZero(Date period);  }
@PrepareForTest({TaskHelper.class}) @Test public void testTomorrowZero1() throws Exception { Date date = new Date(1562671353000L); Date date2 = new Date(1562688000000L); PowerMockito.whenNew(Date.class).withAnyArguments().thenReturn(date); Assert.assertEquals(date2, TaskHelper.tomorrowZero(null)); }
@Test public void testTomorrowZero2() { Assert.assertEquals(new Date(1562601600000L), TaskHelper.tomorrowZero(new Date(1562596622000L))); }