/** * Returns true if both date are in the same year, month, day of month and hour, false otherwise. * @param actual the actual date. expected not be null * @param other the other date. expected not be null * @return true if both date are in the same year, month, day of month and hour, false otherwise. */ private static boolean areInSameHour(Date actual, Date other) { return areInSameDayOfMonth(actual, other) && hourOfDayOf(actual) == hourOfDayOf(other); }
/** * Returns true if both date are in the same year, month, day of month and hour, false otherwise. * @param actual the actual date. expected not be null * @param other the other date. expected not be null * @return true if both date are in the same year, month, day of month and hour, false otherwise. */ private static boolean areInSameHour(Date actual, Date other) { return areInSameDayOfMonth(actual, other) && hourOfDayOf(actual) == hourOfDayOf(other); }
/** * Verifies that the actual {@code Date} hour od day is equal to the given hour of day (24-hour clock). * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @param hourOfDay the hour of day to compare actual hour of day to (24-hour clock) * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} hour is not equal to the given hour. */ public void assertHasHourOfDay(AssertionInfo info, Date actual, int hourOfDay) { assertNotNull(info, actual); if (hourOfDayOf(actual) != hourOfDay) throw failures.failure(info, shouldHaveDateField(actual, "hour", hourOfDay)); }
/** * Verifies that the actual {@code Date} hour od day is equal to the given hour of day (24-hour clock). * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @param hourOfDay the hour of day to compare actual hour of day to (24-hour clock) * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} hour is not equal to the given hour. */ public void assertHasHourOfDay(AssertionInfo info, Date actual, int hourOfDay) { assertNotNull(info, actual); if (hourOfDayOf(actual) != hourOfDay) throw failures.failure(info, shouldHaveDateField(actual, "hour", hourOfDay)); }