Package org.exparity.hamcrest.date
Class DateMatchers
- java.lang.Object
-
- org.exparity.hamcrest.date.DateMatchers
-
public abstract class DateMatchers extends Object
Static factory for creatingMatcherinstances for comparing dates- Author:
- Stewart Bissett
-
-
Field Summary
Fields Modifier and Type Field Description static StringUNSUPPORTED_SQL_DATE_UNIT
-
Constructor Summary
Constructors Constructor Description DateMatchers()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TemporalMatcher<Date>after(int year, Month month, int day)Creates a matcher that matches when the examined date is after the end of the reference yearstatic TemporalMatcher<Date>after(int year, Month month, int dayOfMonth, int hour, int minute, int second)Creates a matcher that matches when the examined date is after the end of the reference yearstatic TemporalMatcher<Date>after(int year, Months month, int day)Deprecated.static TemporalMatcher<Date>after(int year, Months month, int dayOfMonth, int hour, int minute, int second)Deprecated.static TemporalMatcher<Date>after(Date date)Creates a matcher that matches when the examined date is after the reference datestatic TemporalMatcher<Date>after(Instant date)Creates a matcher that matches when the examined date is after the reference datestatic TemporalMatcher<Date>after(LocalDate date)Creates a matcher that matches when the examined date is after the reference datestatic TemporalMatcher<Date>after(LocalDateTime date)Creates a matcher that matches when the examined date is after the reference datestatic TemporalMatcher<Date>after(Date date)Creates a matcher that matches when the examined date is after the reference datestatic TemporalMatcher<Date>after(DayMonthYear date)Deprecated.Useafter(LocalDate)static TemporalMatcher<Date>before(int year, Month month, int day)Creates a matcher that matches when the examined date is before the end of the reference yearstatic TemporalMatcher<Date>before(int year, Month month, int dayOfMonth, int hour, int minute, int second)Creates a matcher that matches when the examined date is before the end of the reference yearstatic TemporalMatcher<Date>before(int year, Months month, int day)Deprecated.static TemporalMatcher<Date>before(int year, Months month, int dayOfMonth, int hour, int minute, int second)Deprecated.static TemporalMatcher<Date>before(Date date)Creates a matcher that matches when the examined date is before the reference datestatic TemporalMatcher<Date>before(Instant date)Creates a matcher that matches when the examined date is before the reference datestatic TemporalMatcher<Date>before(LocalDate date)Creates a matcher that matches when the examined date is before the reference datestatic TemporalMatcher<Date>before(LocalDateTime date)Creates a matcher that matches when the examined date is before the reference datestatic TemporalMatcher<Date>before(Date date)Creates a matcher that matches when the examined date is before the reference datestatic TemporalMatcher<Date>before(DayMonthYear date)Deprecated.static TemporalMatcher<Date>isApril()Creates a matcher that matches when the examined date is in Aprilstatic TemporalMatcher<Date>isAugust()Creates a matcher that matches when the examined date is in Auguststatic TemporalMatcher<Date>isDay(int year, Month month, int dayOfMonth)Creates a matcher that matches when the examined date is on the same day of the year as the reference datestatic TemporalMatcher<Date>isDayOfMonth(int dayOfMonth)Creates a matcher that matches when the examined date is on the expected day of the monthstatic TemporalMatcher<Date>isDayOfWeek(DayOfWeek dayOfWeek)Creates a matcher that matches when the examined date is on the same day of the week as the supplied daystatic TemporalMatcher<Date>isDayOfWeek(DayOfWeek... daysOfWeek)Creates a matcher that matches when the examined date is on the same day of the week as any of the supplied daysstatic TemporalMatcher<Date>isDayOfWeek(Weekdays dayOfWeek)Deprecated.static TemporalMatcher<Date>isDecember()Creates a matcher that matches when the examined date is in Decemberstatic TemporalMatcher<Date>isFebruary()Creates a matcher that matches when the examined date is in Februarystatic TemporalMatcher<Date>isFirstDayOfMonth()Creates a matcher that matches when the examined date is on the first day of the monthstatic TemporalMatcher<Date>isFriday()Creates a matcher that matches when the examined date is on a fridaystatic TemporalMatcher<Date>isHour(int hour)Creates a matcher that matches when the examined date is on the same hour as the reference datestatic TemporalMatcher<Date>isInstant(int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)Creates a matcher that matches when the examined date is on the same instance as the reference datestatic TemporalMatcher<Date>isJanuary()Creates a matcher that matches when the examined date is in Januarystatic TemporalMatcher<Date>isJuly()Creates a matcher that matches when the examined date is in Julystatic TemporalMatcher<Date>isJune()Creates a matcher that matches when the examined date is in Junestatic TemporalMatcher<Date>isLastDayOfMonth()Creates a matcher that matches when the examined date is on the first day of the monthstatic TemporalMatcher<Date>isLeapYear()Creates a matcher that matches when the examined date is a leap yearstatic TemporalMatcher<Date>isMarch()Creates a matcher that matches when the examined date is in Marchstatic TemporalMatcher<Date>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 TemporalMatcher<Date>isMay()Creates a matcher that matches when the examined date is in Maystatic TemporalMatcher<Date>isMillisecond(int millisecond)Creates a matcher that matches when the examined date is on the reference secondstatic TemporalMatcher<Date>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 TemporalMatcher<Date>isMinute(int minute)Creates a matcher that matches when the examined date is on the reference minutestatic TemporalMatcher<Date>isMonday()Creates a matcher that matches when the examined date is on a mondaystatic TemporalMatcher<Date>isMonth(Month month)Creates a matcher that matches when the examined date is in the expected monthstatic TemporalMatcher<Date>isNovember()Creates a matcher that matches when the examined date is in Novemberstatic TemporalMatcher<Date>isOctober()Creates a matcher that matches when the examined date is in Octoberstatic TemporalMatcher<Date>isSaturday()Creates a matcher that matches when the examined date is on a saturdaystatic TemporalMatcher<Date>isSecond(int second)Creates a matcher that matches when the examined date is on the reference secondstatic TemporalMatcher<Date>isSeptember()Creates a matcher that matches when the examined date is in Septemberstatic TemporalMatcher<Date>isSunday()Creates a matcher that matches when the examined date is on a sundaystatic TemporalMatcher<Date>isThursday()Creates a matcher that matches when the examined date is on a thursdaystatic TemporalMatcher<Date>isToday()Creates a matcher that matches when the examined date is todaystatic TemporalMatcher<Date>isTomorrow()Creates a matcher that matches when the examined date is tomorrowstatic TemporalMatcher<Date>isTuesday()Creates a matcher that matches when the examined date is on a tuesdaystatic TemporalMatcher<Date>isWednesday()Creates a matcher that matches when the examined date is on a wednesdaystatic TemporalMatcher<Date>isWeekday()Creates a matcher that matches when the examined date is on a weekdaystatic TemporalMatcher<Date>isWeekend()Creates a matcher that matches when the examined date is on a weekendstatic TemporalMatcher<Date>isYear(int year)Creates a matcher that matches when the examined date is on the same year as the reference yearstatic TemporalMatcher<Date>isYesterday()Creates a matcher that matches when the examined date is yesterdaystatic TemporalMatcher<Date>sameDay(int year, Months month, int day)Deprecated.static TemporalMatcher<Date>sameDay(Date date)Creates a matcher that matches when the examined date is on the same day of the year as the reference datestatic TemporalMatcher<Date>sameDay(LocalDate date)Creates a matcher that matches when the examined date is on the same day of the year as the reference datestatic TemporalMatcher<Date>sameDay(Date date)Creates a matcher that matches when the examined date is on the same day of the year as the reference datestatic TemporalMatcher<Date>sameDay(DayMonthYear date)Deprecated.static TemporalMatcher<Date>sameDayOfMonth(Date date)Creates a matcher that matches when the examined date is on the same day of the month as the reference datestatic TemporalMatcher<Date>sameDayOfWeek(Date date)Creates a matcher that matches when the examined date is on the same day of the week as the reference datestatic TemporalMatcher<Date>sameDayOfWeek(Date date)Creates a matcher that matches when the examined date is on the same day of the week as the reference datestatic TemporalMatcher<Date>sameHour(int hour)Deprecated.UseisHour(int)insteadstatic TemporalMatcher<Date>sameHour(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameHour(Date date)Deprecated.UsesameHourOfDay(Date)insteadstatic TemporalMatcher<Date>sameHourOfDay(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameHourOfDay(Date date)Creates a matcher that matches when the examined date is on the same hour as the reference datestatic TemporalMatcher<Date>sameInstant(int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)Deprecated.static TemporalMatcher<Date>sameInstant(long timestamp)Creates a matcher that matches when the examined date is on the same UTC instant as the reference UTC epoch time suppliedstatic TemporalMatcher<Date>sameInstant(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameInstant(Instant instant)Creates a matcher that matches when the examined date is on the same UTC instant as the reference Instant suppliedstatic TemporalMatcher<Date>sameInstant(Date date)Creates a matcher that matches when the examined date is on the same instant as the reference datestatic TemporalMatcher<Date>sameMillisecond(int millisecond)Deprecated.UseisMillisecond(int)insteadstatic TemporalMatcher<Date>sameMillisecond(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameMillisecond(Date date)Deprecated.UsesameMillisecondOfSecond(Date)insteadstatic TemporalMatcher<Date>sameMillisecondOfSecond(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameMillisecondOfSecond(Date date)Creates a matcher that matches when the examined date is on the same millisecond as the reference datestatic TemporalMatcher<Date>sameMinute(int minute)Deprecated.UseisMinute(int)insteadstatic TemporalMatcher<Date>sameMinute(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameMinute(Date date)Deprecated.UsesameMinuteOfHour(Date)insteadstatic TemporalMatcher<Date>sameMinuteOfHour(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameMinuteOfHour(Date date)Creates a matcher that matches when the examined date is on the same minute as the reference datestatic TemporalMatcher<Date>sameMonth(Date date)Deprecated.UsesameMonthOfYear(Date)insteadstatic TemporalMatcher<Date>sameMonth(Date date)Deprecated.UsesameMonthOfYear(Date)insteadstatic TemporalMatcher<Date>sameMonth(Months month)Deprecated.UsesameMonthOfYear(Months)insteadstatic TemporalMatcher<Date>sameMonthOfYear(Date date)Creates a matcher that matches when the examined date is on the same month as the reference datestatic TemporalMatcher<Date>sameMonthOfYear(Date date)Creates a matcher that matches when the examined date is on the same month as the reference datestatic TemporalMatcher<Date>sameMonthOfYear(Months month)Deprecated.UseisMonth(Month)static TemporalMatcher<Date>sameOrAfter(int year, Month month, int dayOfMonth)Creates a matcher that matches when the examined date is on the same day or after the start of the reference datestatic TemporalMatcher<Date>sameOrAfter(int year, Month month, int dayOfMonth, int hour, int minute, int second)Creates a matcher that matches when the examined date is on the same second or after the start of the reference date and timestatic TemporalMatcher<Date>sameOrAfter(int year, Months month, int dayOfMonth)Deprecated.static TemporalMatcher<Date>sameOrAfter(int year, Months month, int dayOfMonth, int hour, int minute, int second)Deprecated.static TemporalMatcher<Date>sameOrAfter(Date date)F Creates a matcher that matches when the examined date is at the same instant or after the reference datestatic TemporalMatcher<Date>sameOrAfter(LocalDate date)F Creates a matcher that matches when the examined date is at the same instant or after the reference datestatic TemporalMatcher<Date>sameOrAfter(LocalDateTime date)F Creates a matcher that matches when the examined date is at the same instant or after the reference datestatic TemporalMatcher<Date>sameOrAfter(Date date)F Creates a matcher that matches when the examined date is at the same instant or after the reference datestatic TemporalMatcher<Date>sameOrAfter(DayMonthYear date)Deprecated.static TemporalMatcher<Date>sameOrBefore(int year, Month month, int dayOfMonth)Creates a matcher that matches when the examined date is on the same day or before the start of the reference datestatic TemporalMatcher<Date>sameOrBefore(int year, Month month, int dayOfMonth, int hour, int minute, int second)Creates a matcher that matches when the examined date is on the same second or before the start of the reference date and timestatic TemporalMatcher<Date>sameOrBefore(int year, Months month, int dayOfMonth)Deprecated.static TemporalMatcher<Date>sameOrBefore(int year, Months month, int dayOfMonth, int hour, int minute, int second)Deprecated.static TemporalMatcher<Date>sameOrBefore(Date date)Creates a matcher that matches when the examined date is at the same instant or before the reference datestatic TemporalMatcher<Date>sameOrBefore(LocalDate date)Creates a matcher that matches when the examined date is at the same instant or before the reference datestatic TemporalMatcher<Date>sameOrBefore(LocalDateTime date)Creates a matcher that matches when the examined date is at the same instant or before the reference datestatic TemporalMatcher<Date>sameOrBefore(Date date)Creates a matcher that matches when the examined date is at the same instant or before the reference datestatic TemporalMatcher<Date>sameOrBefore(DayMonthYear date)Deprecated.static TemporalMatcher<Date>sameSecond(int second)Deprecated.UseisSecond(int)insteadstatic TemporalMatcher<Date>sameSecond(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameSecond(Date date)Deprecated.UsesameSecondOfMinute(Date)insteadstatic TemporalMatcher<Date>sameSecondOfMinute(Date date)Deprecated.java.sql.Date does not support time-based comparisons.static TemporalMatcher<Date>sameSecondOfMinute(Date date)Creates a matcher that matches when the examined date is on the same second as the reference datestatic TemporalMatcher<Date>sameYear(Date date)Creates a matcher that matches when the examined date is on the same year as the reference datestatic TemporalMatcher<Date>sameYear(Date date)Creates a matcher that matches when the examined date is on the same year as the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth)Creates a matcher that matches when the examined date is within a given period of the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)Creates a matcher that matches when the examined date is within a given period of the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, Date date)Creates a matcher that matches when the examined date is within a defined period the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, LocalDate date)Creates a matcher that matches when the examined date is within a defined period the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, LocalDateTime date)Creates a matcher that matches when the examined date is within a defined period the reference datestatic TemporalMatcher<Date>within(long period, ChronoUnit unit, Date date)Creates a matcher that matches when the examined date is within a defined period the reference datestatic TemporalMatcher<Date>within(long period, TimeUnit unit, int year, Months month, int dayOfMonth)Deprecated.static TemporalMatcher<Date>within(long period, TimeUnit unit, int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)Deprecated.static TemporalMatcher<Date>within(long period, TimeUnit unit, Date date)Deprecated.static TemporalMatcher<Date>within(long period, TimeUnit unit, Date date)Deprecated.static TemporalMatcher<Date>within(long period, TimeUnit unit, DayMonthYear date)Deprecated.
-
-
-
Field Detail
-
UNSUPPORTED_SQL_DATE_UNIT
public static final String UNSUPPORTED_SQL_DATE_UNIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
after
public static TemporalMatcher<Date> after(Date date)
Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(Date date)
Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
@Deprecated public static TemporalMatcher<Date> after(DayMonthYear date)
Deprecated.Useafter(LocalDate)Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(LocalDate date)
Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(LocalDateTime date)
Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(Instant date)
Creates a matcher that matches when the examined date is after the reference date For example:assertThat(myDate, after(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
after
@Deprecated public static TemporalMatcher<Date> after(int year, Months month, int day)
Deprecated.Creates a matcher that matches when the examined date is after the end of the reference year For example:assertThat(myDate, after(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkedday- the day of the month against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(int year, Month month, int day)
Creates a matcher that matches when the examined date is after the end of the reference year For example:assertThat(myDate, after(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkedday- the day of the month against which the examined date is checked
-
after
@Deprecated public static TemporalMatcher<Date> after(int year, Months month, int dayOfMonth, int hour, int minute, int second)
Deprecated.Creates a matcher that matches when the examined date is after the end of the reference year For example:assertThat(myDate, after(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
after
public static TemporalMatcher<Date> after(int year, Month month, int dayOfMonth, int hour, int minute, int second)
Creates a matcher that matches when the examined date is after the end of the reference year For example:assertThat(myDate, after(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(Date date)
Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(Date date)
Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
@Deprecated public static TemporalMatcher<Date> before(DayMonthYear date)
Deprecated.Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(LocalDate date)
Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(LocalDateTime date)
Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(Instant date)
Creates a matcher that matches when the examined date is before the reference date For example:assertThat(myDate, before(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
before
@Deprecated public static TemporalMatcher<Date> before(int year, Months month, int day)
Deprecated.Creates a matcher that matches when the examined date is before the end of the reference year For example:assertThat(myDate, before(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkedday- the day of the month against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(int year, Month month, int day)
Creates a matcher that matches when the examined date is before the end of the reference year For example:assertThat(myDate, before(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkedday- the day of the month against which the examined date is checked
-
before
@Deprecated public static TemporalMatcher<Date> before(int year, Months month, int dayOfMonth, int hour, int minute, int second)
Deprecated.Creates a matcher that matches when the examined date is before the end of the reference year For example:assertThat(myDate, before(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
before
public static TemporalMatcher<Date> before(int year, Month month, int dayOfMonth, int hour, int minute, int second)
Creates a matcher that matches when the examined date is before the end of the reference year For example:assertThat(myDate, before(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
sameDayOfWeek
public static TemporalMatcher<Date> sameDayOfWeek(Date date)
Creates a matcher that matches when the examined date is on the same day of the week as the reference date For example:assertThat(myDate, sameWeekday(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameDayOfWeek
public static TemporalMatcher<Date> sameDayOfWeek(Date date)
Creates a matcher that matches when the examined date is on the same day of the week as the reference date For example:assertThat(myDate, sameWeekday(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
isDayOfWeek
@Deprecated public static TemporalMatcher<Date> isDayOfWeek(Weekdays dayOfWeek)
Deprecated.Creates a matcher that matches when the examined date is on the same day of the week as the supplied day For example:assertThat(myDate, isDayOfWeek(Weekdays.MONDAY))
- Parameters:
dayOfWeek- the reference weekday against which the examined date is checked
-
isDayOfWeek
public static TemporalMatcher<Date> isDayOfWeek(DayOfWeek dayOfWeek)
Creates a matcher that matches when the examined date is on the same day of the week as the supplied day For example:assertThat(myDate, isDayOfWeek(DayOfWeek.MONDAY))
- Parameters:
dayOfWeek- the reference weekday against which the examined date is checked
-
isDayOfWeek
public static TemporalMatcher<Date> isDayOfWeek(DayOfWeek... daysOfWeek)
Creates a matcher that matches when the examined date is on the same day of the week as any of the supplied days For example:assertThat(myDate, isDayOfWeek(DayOfWeek.MONDAY, DayOfWeek.TUESDAY))
- Parameters:
daysOfWeek- the reference weekdays against which the examined date is checked
-
sameDayOfMonth
public static TemporalMatcher<Date> sameDayOfMonth(Date date)
Creates a matcher that matches when the examined date is on the same day of the month as the reference date For example:assertThat(myDate, sameDayOfMonth(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
isDayOfMonth
public static TemporalMatcher<Date> isDayOfMonth(int dayOfMonth)
Creates a matcher that matches when the examined date is on the expected day of the month For example:assertThat(myDate, isDayOfMonth(4))
- Parameters:
dayOfMonth- the expected day of the month
-
sameDay
public static TemporalMatcher<Date> sameDay(Date date)
Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDay(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameDay
public static TemporalMatcher<Date> sameDay(Date date)
Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDay(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameDay
@Deprecated public static TemporalMatcher<Date> sameDay(DayMonthYear date)
Deprecated.Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDay(Moments.today()));
- Parameters:
date- the reference date against which the examined date is checked
-
sameDay
public static TemporalMatcher<Date> sameDay(LocalDate date)
Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDay(Moments.today()));
- Parameters:
date- the reference date against which the examined date is checked
-
sameDay
@Deprecated public static TemporalMatcher<Date> sameDay(int year, Months month, int day)
Deprecated.Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDayOfTheYear(2012, Month.JAN, 1))
- Parameters:
day- the reference day of the month against which the examined date is checkedmonth- the reference month against which the examined date is checkedyear- the reference year against which the examined date is checked
-
isDay
public static TemporalMatcher<Date> isDay(int year, Month month, int dayOfMonth)
Creates a matcher that matches when the examined date is on the same day of the year as the reference date For example:assertThat(myDate, sameDayOfTheYear(2012, Month.JAN, 1))
- Parameters:
dayOfMonth- the reference day of the month against which the examined date is checkedmonth- the reference month against which the examined date is checkedyear- the reference year against which the examined date is checked
-
sameHour
@Deprecated public static TemporalMatcher<Date> sameHour(Date date)
Deprecated.UsesameHourOfDay(Date)insteadCreates a matcher that matches when the examined date is on the same hour as the reference date For example:assertThat(myDate, sameHour(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameHour
@Deprecated public static TemporalMatcher<Date> sameHour(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameHourOfDay
public static TemporalMatcher<Date> sameHourOfDay(Date date)
Creates a matcher that matches when the examined date is on the same hour as the reference date For example:assertThat(myDate, sameHourOfDay(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameHourOfDay
public static TemporalMatcher<Date> sameHourOfDay(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameHour
@Deprecated public static TemporalMatcher<Date> sameHour(int hour)
Deprecated.UseisHour(int)insteadCreates a matcher that matches when the examined date is on the same hour as the reference date For example:assertThat(myDate, sameHour(12));
- Parameters:
hour- the reference hour against which the examined date is checked
-
isHour
public static TemporalMatcher<Date> isHour(int hour)
Creates a matcher that matches when the examined date is on the same hour as the reference date For example:assertThat(myDate, sameHour(12));
- Parameters:
hour- the reference hour against which the examined date is checked
-
sameInstant
public static TemporalMatcher<Date> sameInstant(Date date)
Creates a matcher that matches when the examined date is on the same instant as the reference date For example:assertThat(myDate, sameInstant(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameInstant
@Deprecated public static TemporalMatcher<Date> sameInstant(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameInstant
public static TemporalMatcher<Date> sameInstant(Instant instant)
Creates a matcher that matches when the examined date is on the same UTC instant as the reference Instant supplied For example:assertThat(myDate, sameInstant(Instant.now()))
- Parameters:
instant- theInstant
-
sameInstant
public static TemporalMatcher<Date> sameInstant(long timestamp)
Creates a matcher that matches when the examined date is on the same UTC instant as the reference UTC epoch time supplied For example:assertThat(myDate, sameInstant(1325415600000L))
- Parameters:
timestamp- the time as milliseconds since the Unix epoch time
-
sameInstant
@Deprecated public static TemporalMatcher<Date> sameInstant(int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
Deprecated.Creates a matcher that matches when the examined date is on the same instance as the reference date For example:assertThat(myDate, sameInstant(2012, Months.MAY, 12, 23, 00, 01, 123));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checkedmilliseconds- the milliseconds of the second against which the examined date is checked
-
isInstant
public static TemporalMatcher<Date> isInstant(int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
Creates a matcher that matches when the examined date is on the same instance as the reference date For example:assertThat(myDate, sameInstant(2012, Months.MAY, 12, 23, 00, 01, 123));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checkedmilliseconds- the milliseconds of the second against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(Date date)
Creates a matcher that matches when the examined date is at the same instant or before the reference date For example:assertThat(myDate, sameOrBefore(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(Date date)
Creates a matcher that matches when the examined date is at the same instant or before the reference date For example:assertThat(myDate, sameOrBefore(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(LocalDate date)
Creates a matcher that matches when the examined date is at the same instant or before the reference date For example:assertThat(myDate, sameOrBefore(LocalDate.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(LocalDateTime date)
Creates a matcher that matches when the examined date is at the same instant or before the reference date For example:assertThat(myDate, sameOrBefore(LocalDateTime.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrBefore
@Deprecated public static TemporalMatcher<Date> sameOrBefore(DayMonthYear date)
Deprecated.Creates a matcher that matches when the examined date is at the same date or before the reference date For example:assertThat(myDate, sameOrBefore(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrBefore
@Deprecated public static TemporalMatcher<Date> sameOrBefore(int year, Months month, int dayOfMonth)
Deprecated.Creates a matcher that matches when the examined date is on the same day or before the start of the reference date For example:assertThat(myDate, sameOrBefore(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(int year, Month month, int dayOfMonth)
Creates a matcher that matches when the examined date is on the same day or before the start of the reference date For example:assertThat(myDate, sameOrBefore(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
sameOrBefore
@Deprecated public static TemporalMatcher<Date> sameOrBefore(int year, Months month, int dayOfMonth, int hour, int minute, int second)
Deprecated.Creates a matcher that matches when the examined date is on the same second or before the start of the reference date and time For example:assertThat(myDate, sameOrBefore(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
sameOrBefore
public static TemporalMatcher<Date> sameOrBefore(int year, Month month, int dayOfMonth, int hour, int minute, int second)
Creates a matcher that matches when the examined date is on the same second or before the start of the reference date and time For example:assertThat(myDate, sameOrBefore(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(Date date)
F Creates a matcher that matches when the examined date is at the same instant or after the reference date For example:assertThat(myDate, sameOrAfter(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(Date date)
F Creates a matcher that matches when the examined date is at the same instant or after the reference date For example:assertThat(myDate, sameOrAfter(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(LocalDate date)
F Creates a matcher that matches when the examined date is at the same instant or after the reference date For example:assertThat(myDate, sameOrAfter(LocalDate.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(LocalDateTime date)
F Creates a matcher that matches when the examined date is at the same instant or after the reference date For example:assertThat(myDate, sameOrAfter(LocalDateTime.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrAfter
@Deprecated public static TemporalMatcher<Date> sameOrAfter(DayMonthYear date)
Deprecated.Creates a matcher that matches when the examined date is at the same instant or after the reference date For example:assertThat(myDate, sameOrAfter(Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameOrAfter
@Deprecated public static TemporalMatcher<Date> sameOrAfter(int year, Months month, int dayOfMonth)
Deprecated.Creates a matcher that matches when the examined date is on the same day or after the start of the reference date For example:assertThat(myDate, sameOrAfter(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(int year, Month month, int dayOfMonth)
Creates a matcher that matches when the examined date is on the same day or after the start of the reference date For example:assertThat(myDate, sameOrAfter(2012, Months.MAY, 12));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
sameOrAfter
@Deprecated public static TemporalMatcher<Date> sameOrAfter(int year, Months month, int dayOfMonth, int hour, int minute, int second)
Deprecated.Creates a matcher that matches when the examined date is on the same second or after the start of the reference date and time For example:assertThat(myDate, sameOrAfter(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
sameOrAfter
public static TemporalMatcher<Date> sameOrAfter(int year, Month month, int dayOfMonth, int hour, int minute, int second)
Creates a matcher that matches when the examined date is on the same second or after the start of the reference date and time For example:assertThat(myDate, sameOrAfter(2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
year- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checked
-
sameMinute
@Deprecated public static TemporalMatcher<Date> sameMinute(Date date)
Deprecated.UsesameMinuteOfHour(Date)insteadCreates a matcher that matches when the examined date is on the same minute as the reference date For example:assertThat(myDate, sameMinute(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMinute
@Deprecated public static TemporalMatcher<Date> sameMinute(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameMinuteOfHour
public static TemporalMatcher<Date> sameMinuteOfHour(Date date)
Creates a matcher that matches when the examined date is on the same minute as the reference date For example:assertThat(myDate, sameMinute(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMinuteOfHour
@Deprecated public static TemporalMatcher<Date> sameMinuteOfHour(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameMinute
@Deprecated public static TemporalMatcher<Date> sameMinute(int minute)
Deprecated.UseisMinute(int)insteadCreates a matcher that matches when the examined date is on the reference minute For example:assertThat(myDate, sameMinute(55))
- Parameters:
minute- the reference minute against which the examined date is checked
-
isMinute
public static TemporalMatcher<Date> isMinute(int minute)
Creates a matcher that matches when the examined date is on the reference minute For example:assertThat(myDate, sameMinute(55))
- Parameters:
minute- the reference minute against which the examined date is checked
-
sameMonth
@Deprecated public static TemporalMatcher<Date> sameMonth(Date date)
Deprecated.UsesameMonthOfYear(Date)insteadCreates a matcher that matches when the examined date is on the same month as the reference date For example:assertThat(myDate, sameMonth(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMonth
@Deprecated public static TemporalMatcher<Date> sameMonth(Date date)
Deprecated.UsesameMonthOfYear(Date)insteadCreates a matcher that matches when the examined date is on the same month as the reference date For example:assertThat(myDate, sameMonth(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMonthOfYear
public static TemporalMatcher<Date> sameMonthOfYear(Date date)
Creates a matcher that matches when the examined date is on the same month as the reference date For example:assertThat(myDate, sameMonth(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMonthOfYear
public static TemporalMatcher<Date> sameMonthOfYear(Date date)
Creates a matcher that matches when the examined date is on the same month as the reference date For example:assertThat(myDate, sameMonth(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMonth
@Deprecated public static TemporalMatcher<Date> sameMonth(Months month)
Deprecated.UsesameMonthOfYear(Months)insteadCreates a matcher that matches when the examined date is on the same month as the reference month For example:assertThat(myDate, sameMonth(Months.DECEMBER))
- Parameters:
month- the reference month against which the examined date is checked
-
sameMonthOfYear
@Deprecated public static TemporalMatcher<Date> sameMonthOfYear(Months month)
Deprecated.UseisMonth(Month)Creates a matcher that matches when the examined date is on the same month as the reference month For example:assertThat(myDate, sameMonth(Months.DECEMBER))
- Parameters:
month- the reference month against which the examined date is checked
-
sameSecond
@Deprecated public static TemporalMatcher<Date> sameSecond(Date date)
Deprecated.UsesameSecondOfMinute(Date)insteadCreates a matcher that matches when the examined date is on the same second as the reference date For example:assertThat(myDate, sameSecond(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameSecond
@Deprecated public static TemporalMatcher<Date> sameSecond(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameSecondOfMinute
public static TemporalMatcher<Date> sameSecondOfMinute(Date date)
Creates a matcher that matches when the examined date is on the same second as the reference date For example:assertThat(myDate, sameSecond(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameSecondOfMinute
@Deprecated public static TemporalMatcher<Date> sameSecondOfMinute(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameSecond
@Deprecated public static TemporalMatcher<Date> sameSecond(int second)
Deprecated.UseisSecond(int)insteadCreates a matcher that matches when the examined date is on the reference second For example:assertThat(myDate, sameSecond(33))
- Parameters:
second- the reference date against which the examined date is checked
-
isSecond
public static TemporalMatcher<Date> isSecond(int second)
Creates a matcher that matches when the examined date is on the reference second For example:assertThat(myDate, sameSecond(33))
- Parameters:
second- the reference date against which the examined date is checked
-
sameMillisecond
@Deprecated public static TemporalMatcher<Date> sameMillisecond(Date date)
Deprecated.UsesameMillisecondOfSecond(Date)insteadCreates a matcher that matches when the examined date is on the same millisecond as the reference date For example:assertThat(myDate, sameMillisecond(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMillisecond
@Deprecated public static TemporalMatcher<Date> sameMillisecond(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameMillisecondOfSecond
public static TemporalMatcher<Date> sameMillisecondOfSecond(Date date)
Creates a matcher that matches when the examined date is on the same millisecond as the reference date For example:assertThat(myDate, sameMillisecond(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameMillisecondOfSecond
@Deprecated public static TemporalMatcher<Date> sameMillisecondOfSecond(Date date)
Deprecated.java.sql.Date does not support time-based comparisons. PreferSqlDateMatchersfor java.sql.Date appropriate matchers- Parameters:
date- the reference date against which the examined date is checked- Throws:
TemporalConversionException
-
sameMillisecond
@Deprecated public static TemporalMatcher<Date> sameMillisecond(int millisecond)
Deprecated.UseisMillisecond(int)insteadCreates a matcher that matches when the examined date is on the reference second For example:assertThat(myDate, sameMillisecond(123))
- Parameters:
millisecond- the millisecond against which the examined date is checked
-
isMillisecond
public static TemporalMatcher<Date> isMillisecond(int millisecond)
Creates a matcher that matches when the examined date is on the reference second For example:assertThat(myDate, sameMillisecond(123))
- Parameters:
millisecond- the millisecond against which the examined date is checked
-
sameYear
public static TemporalMatcher<Date> sameYear(Date date)
Creates a matcher that matches when the examined date is on the same year as the reference date For example:assertThat(myDate, sameYear(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
sameYear
public static TemporalMatcher<Date> sameYear(Date date)
Creates a matcher that matches when the examined date is on the same year as the reference date For example:assertThat(myDate, sameYear(new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
isYear
public static TemporalMatcher<Date> isYear(int year)
Creates a matcher that matches when the examined date is on the same year as the reference year For example:assertThat(myDate, sameYear(2013))
- Parameters:
year- the reference year against which the examined date is checked
-
within
@Deprecated public static TemporalMatcher<Date> within(long period, TimeUnit unit, Date date)
Deprecated.Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, Date date)
Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
@Deprecated public static TemporalMatcher<Date> within(long period, TimeUnit unit, Date date)
Deprecated.Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, Date date)
Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, LocalDate date)
Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, ChronoUnit.DAYS, LocalDate.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, LocalDateTime date)
Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, ChronoUnit.DAYS, LocalDateTime.now()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
@Deprecated public static TemporalMatcher<Date> within(long period, TimeUnit unit, DayMonthYear date)
Deprecated.Creates a matcher that matches when the examined date is within a defined period the reference date For example:assertThat(myDate, within(10, TimeUnit.DAYS, Moments.today()))
- Parameters:
date- the reference date against which the examined date is checked
-
within
@Deprecated public static TemporalMatcher<Date> within(long period, TimeUnit unit, int year, Months month, int dayOfMonth)
Deprecated.Creates a matcher that matches when the examined date is within a given period of the reference date For example:assertThat(myDate, within(5, TimeUnit.DAYS, 2012, Months.MAY, 12));
- Parameters:
period- the timeunit interval the examined date should be withunit- the timeunit to define the length of the periodyear- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth)
Creates a matcher that matches when the examined date is within a given period of the reference date For example:assertThat(myDate, within(5, TimeUnit.DAYS, 2012, Months.MAY, 12));
- Parameters:
period- the timeunit interval the examined date should be withunit- the timeunit to define the length of the periodyear- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checked
-
within
@Deprecated public static TemporalMatcher<Date> within(long period, TimeUnit unit, int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
Deprecated.Creates a matcher that matches when the examined date is within a given period of the reference date For example:assertThat(myDate, within(1, TimeUnit.MINUTES, 2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
period- the timeunit interval the examined date should be withunit- the timeunit to define the length of the periodyear- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checkedmilliseconds- the millisecond of the second against which the examined date is checked
-
within
public static TemporalMatcher<Date> within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
Creates a matcher that matches when the examined date is within a given period of the reference date For example:assertThat(myDate, within(1, TimeUnit.MINUTES, 2012, Months.MAY, 12, 23, 00, 01));
- Parameters:
period- the timeunit interval the examined date should be withunit- the timeunit to define the length of the periodyear- the year against which the examined date is checkedmonth- the month against which the examined date is checkeddayOfMonth- the day of the month against which the examined date is checkedhour- the hour of the day against which the examined date is checkedminute- the minute of the hour against which the examined date is checkedsecond- the second of the minute against which the examined date is checkedmilliseconds- the millisecond of the second against which the examined date is checked
-
isYesterday
public static TemporalMatcher<Date> isYesterday()
Creates a matcher that matches when the examined date is yesterday For example:assertThat(myDate, isToday());
-
isToday
public static TemporalMatcher<Date> isToday()
Creates a matcher that matches when the examined date is today For example:assertThat(myDate, isToday());
-
isTomorrow
public static TemporalMatcher<Date> isTomorrow()
Creates a matcher that matches when the examined date is tomorrow For example:assertThat(myDate, isTomorrow());
-
isMonday
public static TemporalMatcher<Date> isMonday()
Creates a matcher that matches when the examined date is on a monday For example:assertThat(myDate, isMonday());
-
isTuesday
public static TemporalMatcher<Date> isTuesday()
Creates a matcher that matches when the examined date is on a tuesday For example:assertThat(myDate, isTuesday());
-
isWednesday
public static TemporalMatcher<Date> isWednesday()
Creates a matcher that matches when the examined date is on a wednesday For example:assertThat(myDate, isWednesday());
-
isThursday
public static TemporalMatcher<Date> isThursday()
Creates a matcher that matches when the examined date is on a thursday For example:assertThat(myDate, isThursday());
-
isFriday
public static TemporalMatcher<Date> isFriday()
Creates a matcher that matches when the examined date is on a friday For example:assertThat(myDate, isFriday());
-
isSaturday
public static TemporalMatcher<Date> isSaturday()
Creates a matcher that matches when the examined date is on a saturday For example:assertThat(myDate, isSaturday());
-
isSunday
public static TemporalMatcher<Date> isSunday()
Creates a matcher that matches when the examined date is on a sunday For example:assertThat(myDate, isSunday());
-
isWeekday
public static TemporalMatcher<Date> isWeekday()
Creates a matcher that matches when the examined date is on a weekday For example:assertThat(myDate, isWeekday());
-
isWeekend
public static TemporalMatcher<Date> isWeekend()
Creates a matcher that matches when the examined date is on a weekend For example:assertThat(myDate, isWeekend());
-
isFirstDayOfMonth
public static TemporalMatcher<Date> isFirstDayOfMonth()
Creates a matcher that matches when the examined date is on the first day of the month For example:assertThat(myDate, isFirstDayOfMonth());
-
isMinimum
public static TemporalMatcher<Date> 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
-
isLastDayOfMonth
public static TemporalMatcher<Date> isLastDayOfMonth()
Creates a matcher that matches when the examined date is on the first day of the month For example:assertThat(myDate, isFirstDayOfMonth());
-
isMaximum
public static TemporalMatcher<Date> 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
-
isMonth
public static TemporalMatcher<Date> isMonth(Month month)
Creates a matcher that matches when the examined date is in the expected month For example:assertThat(myDate, isMonth(Month.AUGUST));
-
isJanuary
public static TemporalMatcher<Date> isJanuary()
Creates a matcher that matches when the examined date is in January For example:assertThat(myDate, isJanuary());
-
isFebruary
public static TemporalMatcher<Date> isFebruary()
Creates a matcher that matches when the examined date is in February For example:assertThat(myDate, isFebruary());
-
isMarch
public static TemporalMatcher<Date> isMarch()
Creates a matcher that matches when the examined date is in March For example:assertThat(myDate, isMarch());
-
isApril
public static TemporalMatcher<Date> isApril()
Creates a matcher that matches when the examined date is in April For example:assertThat(myDate, isApril());
-
isMay
public static TemporalMatcher<Date> isMay()
Creates a matcher that matches when the examined date is in May For example:assertThat(myDate, isMay());
-
isJune
public static TemporalMatcher<Date> isJune()
Creates a matcher that matches when the examined date is in June For example:assertThat(myDate, isJune());
-
isJuly
public static TemporalMatcher<Date> isJuly()
Creates a matcher that matches when the examined date is in July For example:assertThat(myDate, isJuly());
-
isAugust
public static TemporalMatcher<Date> isAugust()
Creates a matcher that matches when the examined date is in August For example:assertThat(myDate, isAugust());
-
isSeptember
public static TemporalMatcher<Date> isSeptember()
Creates a matcher that matches when the examined date is in September For example:assertThat(myDate, isSeptember());
-
isOctober
public static TemporalMatcher<Date> isOctober()
Creates a matcher that matches when the examined date is in October For example:assertThat(myDate, isOctober());
-
isNovember
public static TemporalMatcher<Date> isNovember()
Creates a matcher that matches when the examined date is in November For example:assertThat(myDate, isNovember());
-
isDecember
public static TemporalMatcher<Date> isDecember()
Creates a matcher that matches when the examined date is in December For example:assertThat(myDate, isDecember());
-
isLeapYear
public static TemporalMatcher<Date> isLeapYear()
Creates a matcher that matches when the examined date is a leap year For example:assertThat(myDate, isLeapYear());
-
-