Class ShouldBeCloseTo

  • All Implemented Interfaces:
    ErrorMessageFactory

    public class ShouldBeCloseTo
    extends BasicErrorMessageFactory
    Creates an error message indicating that an assertion that verifies that a Date is close to another one from some delta failed.
    • Constructor Detail

      • ShouldBeCloseTo

        private ShouldBeCloseTo​(java.util.Date actual,
                                java.util.Date other,
                                long deltaInMilliseconds,
                                long difference)
      • ShouldBeCloseTo

        private ShouldBeCloseTo​(java.time.temporal.Temporal actual,
                                java.time.temporal.Temporal other,
                                java.lang.String differenceDescription)
    • Method Detail

      • shouldBeCloseTo

        public static ErrorMessageFactory shouldBeCloseTo​(java.util.Date actual,
                                                          java.util.Date other,
                                                          long deltaInMilliseconds,
                                                          long difference)
        Creates a new ShouldBeCloseTo.
        Parameters:
        actual - the actual value in the failed assertion.
        other - the value used in the failed assertion to compare the actual value to.
        deltaInMilliseconds - the delta used for date comparison, expressed in milliseconds.
        difference - the difference in milliseconds between actual and other dates.
        Returns:
        the created ErrorMessageFactory.
      • shouldBeCloseTo

        public static ErrorMessageFactory shouldBeCloseTo​(java.time.temporal.Temporal actual,
                                                          java.time.temporal.Temporal other,
                                                          java.lang.String differenceDescription)
        Creates a new ShouldBeCloseTo.
        Parameters:
        actual - the actual value in the failed assertion.
        other - the value used in the failed assertion to compare the actual value to.
        differenceDescription - detailed difference description message.
        Returns:
        the created ErrorMessageFactory.
        Since:
        3.7.0