Class TimeMatchers


  • public class TimeMatchers
    extends Object
    • Constructor Detail

      • TimeMatchers

        public TimeMatchers()
    • Method Detail

      • after

        public static <T extends Comparable<T> & Temporal> org.hamcrest.Matcher<T> after​(T time)
        Matches a time strictly after that given
        Type Parameters:
        T - The type of time, e.g. Instant or LocalDateTime
        Parameters:
        time - Time for comparison
      • before

        public static <T extends Comparable<T> & Temporal> org.hamcrest.Matcher<T> before​(T time)
        Matches a time strictly before that given
        Type Parameters:
        T - The type of time, e.g. Instant or LocalDateTime
        Parameters:
        time - Time for comparison
      • between

        public static <T extends Comparable<T>> org.hamcrest.Matcher<T> between​(T earlierOrEqual,
                                                                                T laterOrEqual)
        Matches a Comparable value greater than or equal to the first given value and less than or equal to the second given value
        Type Parameters:
        T - The type to compare, e.g. Temporal or TemporalAmount
      • longerThan

        public static <T extends Comparable<T> & TemporalAmount> org.hamcrest.Matcher<T> longerThan​(T amount)
        Matches an amount of time strictly longer than that specified
        Type Parameters:
        T - The type to compare, typically Duration
        Parameters:
        amount - amount of time for comparison
      • shorterThan

        public static <T extends Comparable<T> & TemporalAmount> org.hamcrest.Matcher<T> shorterThan​(T amount)
        Matches an amount of time strictly shorter than that specified
        Type Parameters:
        T - The type to compare, typically Duration
        Parameters:
        amount - amount of time for comparison
      • matches

        public static org.hamcrest.Matcher<Period> matches​(org.hamcrest.Matcher<Integer> yearsMatcher,
                                                           org.hamcrest.Matcher<Integer> monthsMatcher,
                                                           org.hamcrest.Matcher<Integer> daysMatcher)
        Matches any Period for which the years, months and days match the provided matchers