public abstract class DateMatchers extends Object
Matcher instances for
comparing dates| Constructor and Description |
|---|
DateMatchers() |
| Modifier and Type | Method and Description |
|---|---|
static org.hamcrest.Matcher<Date> |
after(Date date)
Creates a matcher that matches when the examined date is after the
reference date
For example:
|
static org.hamcrest.Matcher<Date> |
after(DayMonthYear date)
Deprecated.
Use
after(LocalDate) |
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
after(int year,
Months month,
int day)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
after(int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
after(LocalDate date)
Creates a matcher that matches when the examined date is after the
reference date
For example:
|
static org.hamcrest.Matcher<Date> |
before(Date date)
Creates a matcher that matches when the examined date is before the
reference date
For example:
|
static org.hamcrest.Matcher<Date> |
before(DayMonthYear date)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
before(int year,
Month month,
int dayOfMonth)
Creates a matcher that matches when the examined date is before the start
of reference day
For example:
|
static org.hamcrest.Matcher<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 start
of the reference date and time
For example:
|
static org.hamcrest.Matcher<Date> |
before(int year,
Months month,
int dayOfMonth)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
before(int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
before(LocalDate date)
Creates a matcher that matches when the examined date is before the
reference date
For example:
|
static org.hamcrest.Matcher<Date> |
isApril()
Creates a matcher that matches when the examined date is in April
For example:
|
static org.hamcrest.Matcher<Date> |
isAugust()
Creates a matcher that matches when the examined date is in August
For example:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
isDayOfMonth(int dayOfMonth)
Creates a matcher that matches when the examined date is on the expected
day of the month
For example:
|
static org.hamcrest.Matcher<Date> |
isDayOfWeek(DayOfWeek... daysOfWeek)
Creates a matcher that matches when the examined date is on the same day
of the week as the supplied day
For example:
|
static org.hamcrest.Matcher<Date> |
isDayOfWeek(Weekdays dayOfWeek)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
isDecember()
Creates a matcher that matches when the examined date is in December
For example:
|
static org.hamcrest.Matcher<Date> |
isFebruary()
Creates a matcher that matches when the examined date is in February
For example:
|
static org.hamcrest.Matcher<Date> |
isFirstDayOfMonth()
Creates a matcher that matches when the examined date is on the first day
of the month
For example:
|
static org.hamcrest.Matcher<Date> |
isFriday()
Creates a matcher that matches when the examined date is on a friday
For example:
|
static org.hamcrest.Matcher<Date> |
isHour(int hour)
Creates a matcher that matches when the examined date is on the same hour
as the reference date
For example:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
isJanuary()
Creates a matcher that matches when the examined date is in January
For example:
|
static org.hamcrest.Matcher<Date> |
isJuly()
Creates a matcher that matches when the examined date is in July
For example:
|
static org.hamcrest.Matcher<Date> |
isJune()
Creates a matcher that matches when the examined date is in June
For example:
|
static org.hamcrest.Matcher<Date> |
isLastDayOfMonth()
Creates a matcher that matches when the examined date is on the first day
of the month
For example:
|
static org.hamcrest.Matcher<Date> |
isLeapYear()
Creates a matcher that matches when the examined date is a leap year
For example:
|
static org.hamcrest.Matcher<Date> |
isMarch()
Creates a matcher that matches when the examined date is in March
For example:
|
static org.hamcrest.Matcher<Date> |
isMaximum(TemporalField 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:
|
static org.hamcrest.Matcher<Date> |
isMay()
Creates a matcher that matches when the examined date is in May
For example:
|
static org.hamcrest.Matcher<Date> |
isMillisecond(int millisecond)
Creates a matcher that matches when the examined date is on the reference
second
For example:
|
static org.hamcrest.Matcher<Date> |
isMinimum(TemporalField 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:
|
static org.hamcrest.Matcher<Date> |
isMinute(int minute)
Creates a matcher that matches when the examined date is on the reference
minute
For example:
|
static org.hamcrest.Matcher<Date> |
isMonday()
Creates a matcher that matches when the examined date is on a monday
For example:
|
static org.hamcrest.Matcher<Date> |
isMonth(Month month)
Creates a matcher that matches when the examined date is in the expected
month
For example:
|
static org.hamcrest.Matcher<Date> |
isNovember()
Creates a matcher that matches when the examined date is in November
For example:
|
static org.hamcrest.Matcher<Date> |
isOctober()
Creates a matcher that matches when the examined date is in October
For example:
|
static org.hamcrest.Matcher<Date> |
isSaturday()
Creates a matcher that matches when the examined date is on a saturday
For example:
|
static org.hamcrest.Matcher<Date> |
isSecond(int second)
Creates a matcher that matches when the examined date is on the reference
second
For example:
|
static org.hamcrest.Matcher<Date> |
isSeptember()
Creates a matcher that matches when the examined date is in September
For example:
|
static org.hamcrest.Matcher<Date> |
isSunday()
Creates a matcher that matches when the examined date is on a sunday
For example:
|
static org.hamcrest.Matcher<Date> |
isThursday()
Creates a matcher that matches when the examined date is on a thursday
For example:
|
static org.hamcrest.Matcher<Date> |
isToday()
Creates a matcher that matches when the examined date is today
For example:
|
static org.hamcrest.Matcher<Date> |
isTomorrow()
Creates a matcher that matches when the examined date is tomorrow
For example:
|
static org.hamcrest.Matcher<Date> |
isTuesday()
Creates a matcher that matches when the examined date is on a tuesday
For example:
|
static org.hamcrest.Matcher<Date> |
isWednesday()
Creates a matcher that matches when the examined date is on a wednesday
For example:
|
static org.hamcrest.Matcher<Date> |
isWeekday()
Creates a matcher that matches when the examined date is on a weekday
For example:
|
static org.hamcrest.Matcher<Date> |
isWeekend()
Creates a matcher that matches when the examined date is on a weekend
For example:
|
static org.hamcrest.Matcher<Date> |
isYear(int year)
Creates a matcher that matches when the examined date is on the same year
as the reference year
For example:
|
static org.hamcrest.Matcher<Date> |
isYesterday()
Creates a matcher that matches when the examined date is yesterday
For example:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameDay(DayMonthYear date)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
sameDay(int year,
Months month,
int day)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameHour(Date date)
Deprecated.
Use
sameHourOfDay(Date) instead |
static org.hamcrest.Matcher<Date> |
sameHour(int hour)
Deprecated.
Use
isHour(int) instead |
static org.hamcrest.Matcher<Date> |
sameHourOfDay(Date date)
Creates a matcher that matches when the examined date is on the same hour
as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameInstant(Date date)
Creates a matcher that matches when the examined date is on the same
instant as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameInstant(int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second,
int milliseconds)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameMillisecond(Date date)
Deprecated.
Use
sameMillisecondOfSecond(Date) instead |
static org.hamcrest.Matcher<Date> |
sameMillisecond(int millisecond)
Deprecated.
Use
isMillisecond(int) instead |
static org.hamcrest.Matcher<Date> |
sameMillisecondOfSecond(Date date)
Creates a matcher that matches when the examined date is on the same
millisecond as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameMinute(Date date)
Deprecated.
Use
sameMinuteOfHour(Date) instead |
static org.hamcrest.Matcher<Date> |
sameMinute(int minute)
Deprecated.
Use
isMinute(int) instead |
static org.hamcrest.Matcher<Date> |
sameMinuteOfHour(Date date)
Creates a matcher that matches when the examined date is on the same
minute as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameMonth(Date date)
Deprecated.
Use
sameMonthOfYear(Date) instead |
static org.hamcrest.Matcher<Date> |
sameMonth(Months month)
Deprecated.
Use
sameMonthOfYear(Months) instead |
static org.hamcrest.Matcher<Date> |
sameMonthOfYear(Date date)
Creates a matcher that matches when the examined date is on the same
month as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameMonthOfYear(Months month)
Deprecated.
Use
isMonth(Month) |
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameOrAfter(DayMonthYear date)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameOrAfter(int year,
Months month,
int dayOfMonth)
Deprecated.
Use {@link #sameOrAfter(int, Month, int)
|
static org.hamcrest.Matcher<Date> |
sameOrAfter(int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameOrBefore(DayMonthYear date)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameOrBefore(int year,
Months month,
int dayOfMonth)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
sameOrBefore(int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second)
Deprecated.
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
sameSecond(Date date)
Deprecated.
Use
sameSecondOfMinute(Date) instead |
static org.hamcrest.Matcher<Date> |
sameSecond(int second)
Deprecated.
Use
isSecond(int) instead |
static org.hamcrest.Matcher<Date> |
sameSecondOfMinute(Date date)
Creates a matcher that matches when the examined date is on the same
second as the reference date
For example:
|
static org.hamcrest.Matcher<Date> |
sameYear(Date date)
Creates a matcher that matches when the examined date is on the same year
as the reference date
For example:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<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:
|
static org.hamcrest.Matcher<Date> |
within(long period,
TimeUnit unit,
Date date)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
within(long period,
TimeUnit unit,
DayMonthYear date)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
within(long period,
TimeUnit unit,
int year,
Months month,
int dayOfMonth)
Deprecated.
|
static org.hamcrest.Matcher<Date> |
within(long period,
TimeUnit unit,
int year,
Months month,
int dayOfMonth,
int hour,
int minute,
int second,
int milliseconds)
Deprecated.
|
public static org.hamcrest.Matcher<Date> after(Date date)
assertThat(myDate, after(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> after(DayMonthYear date)
after(LocalDate)assertThat(myDate, after(Moments.today()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> after(LocalDate date)
assertThat(myDate, after(Moments.today()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> after(int year, Months month, int day)
after(int, Month, int)assertThat(myDate, after(2012, Months.MAY, 12));
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
checkedpublic static org.hamcrest.Matcher<Date> after(int year, Month month, int day)
assertThat(myDate, after(2012, Months.MAY, 12));
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@Deprecated public static org.hamcrest.Matcher<Date> after(int year, Months month, int dayOfMonth, int hour, int minute, int second)
after(int, Month, int, int, int, int)assertThat(myDate, after(2012, Months.MAY, 12, 23, 00, 01));
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
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
checkedpublic static org.hamcrest.Matcher<Date> after(int year, Month month, int dayOfMonth, int hour, int minute, int second)
assertThat(myDate, after(2012, Months.MAY, 12, 23, 00, 01));
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
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
checkedpublic static org.hamcrest.Matcher<Date> before(Date date)
assertThat(myDate, before(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> before(LocalDate date)
assertThat(myDate, before(LocalDate.now()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> before(DayMonthYear date)
before(LocalDate)assertThat(myDate, before(Moments.today()));
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> before(int year, Months month, int dayOfMonth)
before(int, Month, int)assertThat(myDate, before(2012, Months.MAY, 12));
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
checkedpublic static org.hamcrest.Matcher<Date> before(int year, Month month, int dayOfMonth)
assertThat(myDate, before(2012, Months.MAY, 12));
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@Deprecated public static org.hamcrest.Matcher<Date> before(int year, Months month, int dayOfMonth, int hour, int minute, int second)
before(int, Month, int, int, int, int)assertThat(myDate, before(2012, Months.MAY, 12, 23, 00, 01));
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
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
checkedpublic static org.hamcrest.Matcher<Date> before(int year, Month month, int dayOfMonth, int hour, int minute, int second)
assertThat(myDate, before(2012, Months.MAY, 12, 23, 00, 01));
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
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
checkedpublic static org.hamcrest.Matcher<Date> sameDayOfWeek(Date date)
assertThat(myDate, sameWeekday(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> isDayOfWeek(Weekdays dayOfWeek)
isDayOfWeek(DayOfWeek...)assertThat(myDate, isDayOfWeek(Weekdays.MONDAY))
weekday - the reference weekday against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> isDayOfWeek(DayOfWeek... daysOfWeek)
assertThat(myDate, isDayOfWeek(DayOfWeek.MONDAY))
weekday - the reference weekday against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> sameDayOfMonth(Date date)
assertThat(myDate, sameDayOfMonth(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> isDayOfMonth(int dayOfMonth)
assertThat(myDate, isDayOfMonth(4))
date - the expected day of the monthpublic static org.hamcrest.Matcher<Date> sameDay(Date date)
assertThat(myDate, sameDay(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameDay(DayMonthYear date)
sameDay(LocalDate)assertThat(myDate, sameDay(Moments.today()));
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameDay(LocalDate date)
assertThat(myDate, sameDay(Moments.today()));
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameDay(int year, Months month, int day)
isDay(int, Month, int)assertThat(myDate, sameDayOfTheYear(2012, Month.JAN, 1))
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 checkedpublic static org.hamcrest.Matcher<Date> isDay(int year, Month month, int dayOfMonth)
assertThat(myDate, sameDayOfTheYear(2012, Month.JAN, 1))
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@Deprecated public static org.hamcrest.Matcher<Date> sameHour(Date date)
sameHourOfDay(Date) insteadassertThat(myDate, sameHour(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameHourOfDay(Date date)
assertThat(myDate, sameHourOfDay(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameHour(int hour)
isHour(int) insteadassertThat(myDate, sameHour(12));
hour - the reference hour against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> isHour(int hour)
assertThat(myDate, sameHour(12));
hour - the reference hour against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameInstant(Date date)
assertThat(myDate, sameInstant(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameInstant(long timestamp)
assertThat(myDate, sameInstant(1325415600000L))
timestamp - the time as milliseconds since the Unix epoch time@Deprecated public static org.hamcrest.Matcher<Date> sameInstant(int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
isInstant(int, Month, int, int, int, int, int)assertThat(myDate, sameInstant(2012, Months.MAY, 12, 23, 00, 01, 123));
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
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 checkedpublic static org.hamcrest.Matcher<Date> isInstant(int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
assertThat(myDate, sameInstant(2012, Months.MAY, 12, 23, 00, 01, 123));
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
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 checkedpublic static org.hamcrest.Matcher<Date> sameOrBefore(Date date)
assertThat(myDate, sameOrBefore(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameOrBefore(LocalDate date)
assertThat(myDate, sameOrBefore(LocalDate.now()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameOrBefore(DayMonthYear date)
sameOrBefore(LocalDate)assertThat(myDate, sameOrBefore(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameOrBefore(int year, Months month, int dayOfMonth)
sameOrBefore(int, Month, int)assertThat(myDate, sameOrBefore(2012, Months.MAY, 12));
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
checkedpublic static org.hamcrest.Matcher<Date> sameOrBefore(int year, Month month, int dayOfMonth)
assertThat(myDate, sameOrBefore(2012, Months.MAY, 12));
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@Deprecated public static org.hamcrest.Matcher<Date> sameOrBefore(int year, Months month, int dayOfMonth, int hour, int minute, int second)
sameOrBefore(int, Month, int, int, int, int)assertThat(myDate, sameOrBefore(2012, Months.MAY, 12, 23, 00, 01));
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
checkedpublic static org.hamcrest.Matcher<Date> sameOrBefore(int year, Month month, int dayOfMonth, int hour, int minute, int second)
assertThat(myDate, sameOrBefore(2012, Months.MAY, 12, 23, 00, 01));
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
checkedpublic static org.hamcrest.Matcher<Date> sameOrAfter(Date date)
assertThat(myDate, sameOrAfter(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameOrAfter(LocalDate date)
assertThat(myDate, sameOrAfter(LocalDate.now()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameOrAfter(DayMonthYear date)
sameOrAfter(LocalDate)assertThat(myDate, sameOrAfter(Moments.today()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameOrAfter(int year, Months month, int dayOfMonth)
assertThat(myDate, sameOrAfter(2012, Months.MAY, 12));
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
checkedpublic static org.hamcrest.Matcher<Date> sameOrAfter(int year, Month month, int dayOfMonth)
assertThat(myDate, sameOrAfter(2012, Months.MAY, 12));
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@Deprecated public static org.hamcrest.Matcher<Date> sameOrAfter(int year, Months month, int dayOfMonth, int hour, int minute, int second)
sameOrAfter(int, Month, int, int, int, int)assertThat(myDate, sameOrAfter(2012, Months.MAY, 12, 23, 00, 01));
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
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
checkedpublic static org.hamcrest.Matcher<Date> sameOrAfter(int year, Month month, int dayOfMonth, int hour, int minute, int second)
assertThat(myDate, sameOrAfter(2012, Months.MAY, 12, 23, 00, 01));
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
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@Deprecated public static org.hamcrest.Matcher<Date> sameMinute(Date date)
sameMinuteOfHour(Date) insteadassertThat(myDate, sameMinute(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameMinuteOfHour(Date date)
assertThat(myDate, sameMinute(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameMinute(int minute)
isMinute(int) insteadassertThat(myDate, sameMinute(55))
minute - the reference minute against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> isMinute(int minute)
assertThat(myDate, sameMinute(55))
minute - the reference minute against which the examined date is
checked@Deprecated public static org.hamcrest.Matcher<Date> sameMonth(Date date)
sameMonthOfYear(Date) insteadassertThat(myDate, sameMonth(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameMonthOfYear(Date date)
assertThat(myDate, sameMonth(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameMonth(Months month)
sameMonthOfYear(Months) insteadassertThat(myDate, sameMonth(Months.DECEMBER))
month - the reference month against which the examined date is
checked@Deprecated public static org.hamcrest.Matcher<Date> sameMonthOfYear(Months month)
isMonth(Month)assertThat(myDate, sameMonth(Months.DECEMBER))
month - the reference month against which the examined date is
checked@Deprecated public static org.hamcrest.Matcher<Date> sameSecond(Date date)
sameSecondOfMinute(Date) insteadassertThat(myDate, sameSecond(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameSecondOfMinute(Date date)
assertThat(myDate, sameSecond(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameSecond(int second)
isSecond(int) insteadassertThat(myDate, sameSecond(33))
second - the reference date against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> isSecond(int second)
assertThat(myDate, sameSecond(33))
second - the reference date against which the examined date is
checked@Deprecated public static org.hamcrest.Matcher<Date> sameMillisecond(Date date)
sameMillisecondOfSecond(Date) insteadassertThat(myDate, sameMillisecond(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> sameMillisecondOfSecond(Date date)
assertThat(myDate, sameMillisecond(new Date()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> sameMillisecond(int millisecond)
isMillisecond(int) insteadassertThat(myDate, sameMillisecond(123))
millisecond - the millisecond against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> isMillisecond(int millisecond)
assertThat(myDate, sameMillisecond(123))
millisecond - the millisecond against which the examined date is
checkedpublic static org.hamcrest.Matcher<Date> sameYear(Date date)
assertThat(myDate, sameYear(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> isYear(int year)
assertThat(myDate, sameYear(2013))
year - the reference year against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> within(long period, TimeUnit unit, Date date)
within(long, ChronoUnit, Date)assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> within(long period, ChronoUnit unit, Date date)
assertThat(myDate, within(10, TimeUnit.MINUTES, new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<Date> within(long period, ChronoUnit unit, LocalDate date)
assertThat(myDate, within(10, ChronoUnit.DAYS, LocalDate.now()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> within(long period, TimeUnit unit, DayMonthYear date)
within(long, ChronoUnit, LocalDate)assertThat(myDate, within(10, TimeUnit.DAYS, Moments.today()))
date - the reference date against which the examined date is checked@Deprecated public static org.hamcrest.Matcher<Date> within(long period, TimeUnit unit, int year, Months month, int dayOfMonth)
within(long, ChronoUnit, int, Month, int)assertThat(myDate, within(5, TimeUnit.DAYS, 2012, Months.MAY, 12));
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
checkedpublic static org.hamcrest.Matcher<Date> within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth)
assertThat(myDate, within(5, TimeUnit.DAYS, 2012, Months.MAY, 12));
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@Deprecated public static org.hamcrest.Matcher<Date> within(long period, TimeUnit unit, int year, Months month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
within(long, ChronoUnit, int, Month, int, int, int, int, int)assertThat(myDate, within(1, TimeUnit.MINUTES, 2012, Months.MAY, 12, 23, 00, 01));
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 checkedday - 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
checkedsecond - the millisecond of the second against which the examined
date is checkedpublic static org.hamcrest.Matcher<Date> within(long period, ChronoUnit unit, int year, Month month, int dayOfMonth, int hour, int minute, int second, int milliseconds)
assertThat(myDate, within(1, TimeUnit.MINUTES, 2012, Months.MAY, 12, 23, 00, 01));
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 checkedday - 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
checkedsecond - the millisecond of the second against which the examined
date is checkedpublic static org.hamcrest.Matcher<Date> isYesterday()
assertThat(myDate, isToday());
public static org.hamcrest.Matcher<Date> isToday()
assertThat(myDate, isToday());
public static org.hamcrest.Matcher<Date> isTomorrow()
assertThat(myDate, isTomorrow());
public static org.hamcrest.Matcher<Date> isMonday()
assertThat(myDate, isMonday());
public static org.hamcrest.Matcher<Date> isTuesday()
assertThat(myDate, isTuesday());
public static org.hamcrest.Matcher<Date> isWednesday()
assertThat(myDate, isWednesday());
public static org.hamcrest.Matcher<Date> isThursday()
assertThat(myDate, isThursday());
public static org.hamcrest.Matcher<Date> isFriday()
assertThat(myDate, isFriday());
public static org.hamcrest.Matcher<Date> isSaturday()
assertThat(myDate, isSaturday());
public static org.hamcrest.Matcher<Date> isSunday()
assertThat(myDate, isSunday());
public static org.hamcrest.Matcher<Date> isWeekday()
assertThat(myDate, isWeekday());
public static org.hamcrest.Matcher<Date> isWeekend()
assertThat(myDate, isWeekend());
public static org.hamcrest.Matcher<Date> isFirstDayOfMonth()
assertThat(myDate, isFirstDayOfMonth());
public static org.hamcrest.Matcher<Date> isMinimum(TemporalField field)
assertThat(myDate, isMaximumDayOfMonth(ChronoField.DAY_OF_MONTH));
field - the temporal field to checkpublic static org.hamcrest.Matcher<Date> isLastDayOfMonth()
assertThat(myDate, isFirstDayOfMonth());
public static org.hamcrest.Matcher<Date> isMaximum(TemporalField field)
assertThat(myDate, isMaximum(ChronoField.DAY_OF_MONTH));
field - the temporal field to checkpublic static org.hamcrest.Matcher<Date> isMonth(Month month)
assertThat(myDate, isMonth(Month.AUGUST));
public static org.hamcrest.Matcher<Date> isJanuary()
assertThat(myDate, isJanuary());
public static org.hamcrest.Matcher<Date> isFebruary()
assertThat(myDate, isFebruary());
public static org.hamcrest.Matcher<Date> isMarch()
assertThat(myDate, isMarch());
public static org.hamcrest.Matcher<Date> isApril()
assertThat(myDate, isApril());
public static org.hamcrest.Matcher<Date> isMay()
assertThat(myDate, isMay());
public static org.hamcrest.Matcher<Date> isJune()
assertThat(myDate, isJune());
public static org.hamcrest.Matcher<Date> isJuly()
assertThat(myDate, isJuly());
public static org.hamcrest.Matcher<Date> isAugust()
assertThat(myDate, isAugust());
public static org.hamcrest.Matcher<Date> isSeptember()
assertThat(myDate, isSeptember());
public static org.hamcrest.Matcher<Date> isOctober()
assertThat(myDate, isOctober());
public static org.hamcrest.Matcher<Date> isNovember()
assertThat(myDate, isNovember());
public static org.hamcrest.Matcher<Date> isDecember()
assertThat(myDate, isDecember());
public static org.hamcrest.Matcher<Date> isLeapYear()
assertThat(myDate, isLeapYear());
Copyright © 2015. All rights reserved.