/** * Verifies that the actual {@code Date} is strictly in the future. * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not in the future. */ public void assertIsInTheFuture(AssertionInfo info, Date actual) { assertNotNull(info, actual); if (!isAfter(actual, now())) throw failures.failure(info, shouldBeInTheFuture(actual, comparisonStrategy)); }
/** * Verifies that the actual {@code Date} is strictly in the past. * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not in the past. */ public void assertIsInThePast(AssertionInfo info, Date actual) { assertNotNull(info, actual); if (!isBefore(actual, now())) throw failures.failure(info, shouldBeInThePast(actual, comparisonStrategy)); }
/** * Verifies that the actual {@code Date} is strictly in the past. * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not in the past. */ public void assertIsInThePast(AssertionInfo info, Date actual) { assertNotNull(info, actual); if (!isBefore(actual, now())) throw failures.failure(info, shouldBeInThePast(actual, comparisonStrategy)); }
/** * Verifies that the actual {@code Date} is strictly in the future. * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not in the future. */ public void assertIsInTheFuture(AssertionInfo info, Date actual) { assertNotNull(info, actual); if (!isAfter(actual, now())) throw failures.failure(info, shouldBeInTheFuture(actual, comparisonStrategy)); }
/** * Verifies that the actual {@code Date} is today, by comparing only year, month and day of actual to today (ie. we don't check * hours). * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not today. */ public void assertIsToday(AssertionInfo info, Date actual) { assertNotNull(info, actual); Date todayWithoutTime = truncateTime(now()); Date actualWithoutTime = truncateTime(actual); if (!areEqual(actualWithoutTime, todayWithoutTime)) throw failures.failure(info, shouldBeToday(actual, comparisonStrategy)); }
/** * Verifies that the actual {@code Date} is today, by comparing only year, month and day of actual to today (ie. we don't check * hours). * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @throws AssertionError if {@code actual} is {@code null}. * @throws AssertionError if the actual {@code Date} is not today. */ public void assertIsToday(AssertionInfo info, Date actual) { assertNotNull(info, actual); Date todayWithoutTime = truncateTime(now()); Date actualWithoutTime = truncateTime(actual); if (!areEqual(actualWithoutTime, todayWithoutTime)) throw failures.failure(info, shouldBeToday(actual, comparisonStrategy)); }