Package org.exparity.hamcrest.date
Class LocalTimeMatchers
- java.lang.Object
-
- org.exparity.hamcrest.date.LocalTimeMatchers
-
-
Constructor Summary
Constructors Constructor Description LocalTimeMatchers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.hamcrest.Matcher<LocalTime>after(int hour, int minute, int second)Creates a matcher that matches when the examined time is after the end of the reference yearstatic org.hamcrest.Matcher<LocalTime>after(LocalTime time)Creates a matcher that matches when the examined time is after the reference timestatic org.hamcrest.Matcher<LocalTime>before(int hour, int minute, int second)Creates a matcher that matches when the examined time is before the end of the reference yearstatic org.hamcrest.Matcher<LocalTime>before(LocalTime time)Creates a matcher that matches when the examined time is before the reference timestatic org.hamcrest.Matcher<LocalTime>isHour(int hour)Creates a matcher that matches when the examined time is on the expected hour (0-23)static org.hamcrest.Matcher<LocalTime>isMaximum(ChronoField field)Creates a matcher that matches when the examined date is on the maximum value of the given date part in its periodstatic org.hamcrest.Matcher<LocalTime>isMinimum(ChronoField field)Creates a matcher that matches when the examined date is on the maximum value of the given date part in its periodstatic org.hamcrest.Matcher<LocalTime>isMinute(int minute)Creates a matcher that matches when the examined time is on the expected minute (0-59)static org.hamcrest.Matcher<LocalTime>isSecond(int second)Creates a matcher that matches when the examined time is on the expected second (0-59)static org.hamcrest.Matcher<LocalTime>sameHourOfDay(LocalTime time)Creates a matcher that matches when the examined time is on the same hour as the reference timestatic org.hamcrest.Matcher<LocalTime>sameMinuteOfHour(LocalTime time)Creates a matcher that matches when the examined time is on the same minute as the reference timestatic org.hamcrest.Matcher<LocalTime>sameOrAfter(int hour, int minute, int second)Creates a matcher that matches when the examined time is on the same day or after the start of the reference timestatic org.hamcrest.Matcher<LocalTime>sameOrAfter(LocalTime time)Creates a matcher that matches when the examined time is at the same instant or after the reference timestatic org.hamcrest.Matcher<LocalTime>sameOrBefore(int hour, int minute, int second)Creates a matcher that matches when the examined time is on the same day or before the start of the reference timestatic org.hamcrest.Matcher<LocalTime>sameOrBefore(LocalTime time)Creates a matcher that matches when the examined time is at the same instant or before the reference timestatic org.hamcrest.Matcher<LocalTime>sameSecondOfMinute(LocalTime time)Creates a matcher that matches when the examined time is on the same second as the reference timestatic org.hamcrest.Matcher<LocalTime>within(long period, ChronoUnit unit, int hour, int minute, int second)Creates a matcher that matches when the examined time is within a given period of the reference timestatic org.hamcrest.Matcher<LocalTime>within(long period, ChronoUnit unit, LocalTime time)Creates a matcher that matches when the examined time is within a defined period the reference time
-
-
-
Method Detail
-
after
public static org.hamcrest.Matcher<LocalTime> after(LocalTime time)
Creates a matcher that matches when the examined time is after the reference time For example:MatcherAssert.assertThat(myTime, LocalTimeMatchers.after(LocalTime.now()));
- Parameters:
time- the reference time against which the examined time is checked
-
after
public static org.hamcrest.Matcher<LocalTime> after(int hour, int minute, int second)
Creates a matcher that matches when the examined time is after the end of the reference year For example:MatcherAssert.assertThat(myTime, LocalTimeMatchers.after(23,59,59);
- Parameters:
hour- the hour of the dayminute- the minute of the hoursecond- the second of the minute
-
before
public static org.hamcrest.Matcher<LocalTime> before(LocalTime time)
Creates a matcher that matches when the examined time is before the reference time For example:MatcherAssert.assertThat(myTime, LocalTimeMatchers.before(LocalTime.now()));
- Parameters:
time- the reference time against which the examined time is checked
-
before
public static org.hamcrest.Matcher<LocalTime> before(int hour, int minute, int second)
Creates a matcher that matches when the examined time is before the end of the reference year For example:MatcherAssert.assertThat(myTime, LocalTimeMatchers.before(23,59,59);
- Parameters:
hour- the hour of the dayminute- the minute of the hoursecond- the second of the minute
-
sameOrBefore
public static org.hamcrest.Matcher<LocalTime> sameOrBefore(LocalTime time)
Creates a matcher that matches when the examined time is at the same instant or before the reference time For example:assertThat(myTime, isSameOrBefore(LocalTime.now()))
- Parameters:
time- the reference time against which the examined time is checked
-
sameOrBefore
public static org.hamcrest.Matcher<LocalTime> sameOrBefore(int hour, int minute, int second)
Creates a matcher that matches when the examined time is on the same day or before the start of the reference time For example:assertThat(myTime, isSameOrBefore(23, 59, 59));
- Parameters:
hour- the hour of the dayminute- the minute of the hoursecond- the second of the minute
-
sameOrAfter
public static org.hamcrest.Matcher<LocalTime> sameOrAfter(LocalTime time)
Creates a matcher that matches when the examined time is at the same instant or after the reference time For example:assertThat(myTime, isSameOrAfter(LocalTime.now()))
- Parameters:
time- the reference time against which the examined time is checked
-
sameOrAfter
public static org.hamcrest.Matcher<LocalTime> sameOrAfter(int hour, int minute, int second)
Creates a matcher that matches when the examined time is on the same day or after the start of the reference time For example:assertThat(myTime, isSameOrAfter(23, 59, 59));
- Parameters:
hour- the hour of the dayminute- the minute of the hoursecond- the second of the minute
-
within
public static org.hamcrest.Matcher<LocalTime> within(long period, ChronoUnit unit, LocalTime time)
Creates a matcher that matches when the examined time is within a defined period the reference time For example:assertThat(myTime, within(10, TimeUnit.SECONDS, LocalTime.NOON))
- Parameters:
time- the reference time against which the examined time is checked
-
within
public static org.hamcrest.Matcher<LocalTime> within(long period, ChronoUnit unit, int hour, int minute, int second)
Creates a matcher that matches when the examined time is within a given period of the reference time For example:assertThat(myTime, within(10, TimeUnit.SECONDS, 23, 59, 59));
- Parameters:
period- the timeunit interval the examined time should be withunit- the timeunit to define the length of the periodhour- the hour of the dayminute- the minute of the hoursecond- the second of the minute
-
isMinimum
public static org.hamcrest.Matcher<LocalTime> isMinimum(ChronoField field)
Creates a matcher that matches when the examined date is on the maximum value of the given date part in its period For example:assertThat(myDate, isMaximumDayOfMonth(ChronoField.DAY_OF_MONTH));
- Parameters:
field- the temporal field to check
-
isMaximum
public static org.hamcrest.Matcher<LocalTime> isMaximum(ChronoField field)
Creates a matcher that matches when the examined date is on the maximum value of the given date part in its period For example:assertThat(myDate, isMaximum(ChronoField.DAY_OF_MONTH));
- Parameters:
field- the temporal field to check
-
isHour
public static org.hamcrest.Matcher<LocalTime> isHour(int hour)
Creates a matcher that matches when the examined time is on the expected hour (0-23) For example:assertThat(myTime, isHour(12));
- Parameters:
hour- the hour of the day (0-23)
-
sameHourOfDay
public static org.hamcrest.Matcher<LocalTime> sameHourOfDay(LocalTime time)
Creates a matcher that matches when the examined time is on the same hour as the reference time For example:assertThat(myTime, sameHourOfDay(LocalTime.now()))
- Parameters:
time- the reference time against which the examined time is checked
-
isMinute
public static org.hamcrest.Matcher<LocalTime> isMinute(int minute)
Creates a matcher that matches when the examined time is on the expected minute (0-59) For example:assertThat(myTime, isMinute(12));
- Parameters:
minute- the minute of the day (0-59)
-
sameMinuteOfHour
public static org.hamcrest.Matcher<LocalTime> sameMinuteOfHour(LocalTime time)
Creates a matcher that matches when the examined time is on the same minute as the reference time For example:assertThat(myTime, sameMinuteOfHour(LocalTime.now()))
- Parameters:
time- the reference time against which the examined time is checked
-
isSecond
public static org.hamcrest.Matcher<LocalTime> isSecond(int second)
Creates a matcher that matches when the examined time is on the expected second (0-59) For example:assertThat(myTime, isSecond(12));
- Parameters:
second- the second of the day (0-59)
-
sameSecondOfMinute
public static org.hamcrest.Matcher<LocalTime> sameSecondOfMinute(LocalTime time)
Creates a matcher that matches when the examined time is on the same second as the reference time For example:assertThat(myTime, sameSecondOfMinute(LocalTime.now()))
- Parameters:
time- the reference time against which the examined time is checked
-
-