| Constructor and Description |
|---|
LocalDateMatchers() |
| Modifier and Type | Method and Description |
|---|---|
static org.hamcrest.Matcher<LocalDate> |
after(int year,
Month month,
int dayOfMonth)
Creates a matcher that matches when the examined date is after the end of
the reference year
For example:
|
static org.hamcrest.Matcher<LocalDate> |
after(LocalDate date)
Creates a matcher that matches when the examined date is after the
reference date
For example:
|
static org.hamcrest.Matcher<LocalDate> |
before(int year,
Month month,
int dayOfMonth)
Creates a matcher that matches when the examined date is before the end
of the reference year
For example:
|
static org.hamcrest.Matcher<LocalDate> |
before(LocalDate date)
Creates a matcher that matches when the examined date is before the
reference date
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isApril()
Creates a matcher that matches when the examined date is in April
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isAugust()
Creates a matcher that matches when the examined date is in August
For example:
|
static org.hamcrest.Matcher<LocalDate> |
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<LocalDate> |
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<LocalDate> |
isDayOfWeek(DayOfWeek... dayOfWeek)
Creates a matcher that matches when the examined date is on a monday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isDecember()
Creates a matcher that matches when the examined date is in December
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isFebruary()
Creates a matcher that matches when the examined date is in February
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isFirstDayOfMonth()
Creates a matcher that matches when the examined date is on the first day
of the month
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isFriday()
Creates a matcher that matches when the examined date is on a friday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isJanuary()
Creates a matcher that matches when the examined date is in January
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isJuly()
Creates a matcher that matches when the examined date is in July
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isJune()
Creates a matcher that matches when the examined date is in June
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isLastDayOfMonth()
Creates a matcher that matches when the examined date is on the first day
of the month
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isLeapYear()
Creates a matcher that matches when the examined date is a leap year
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isMarch()
Creates a matcher that matches when the examined date is in March
For example:
|
static org.hamcrest.Matcher<LocalDate> |
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<LocalDate> |
isMay()
Creates a matcher that matches when the examined date is in May
For example:
|
static org.hamcrest.Matcher<LocalDate> |
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<LocalDate> |
isMonday()
Creates a matcher that matches when the examined date is on a monday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isMonth(Month month)
Creates a matcher that matches when the examined date is in the expected
month
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isNovember()
Creates a matcher that matches when the examined date is in November
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isOctober()
Creates a matcher that matches when the examined date is in October
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isSaturday()
Creates a matcher that matches when the examined date is on a saturday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isSeptember()
Creates a matcher that matches when the examined date is in September
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isSunday()
Creates a matcher that matches when the examined date is on a sunday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isThursday()
Creates a matcher that matches when the examined date is on a thursday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isToday()
Creates a matcher that matches when the examined date is today
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isTomorrow()
Creates a matcher that matches when the examined date is tomorrow
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isTuesday()
Creates a matcher that matches when the examined date is on a tuesday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isWednesday()
Creates a matcher that matches when the examined date is on a wednesday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isWeekday()
Creates a matcher that matches when the examined date is on a weekday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
isWeekend()
Creates a matcher that matches when the examined date is on a weekend
For example:
|
static org.hamcrest.Matcher<LocalDate> |
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<LocalDate> |
isYesterday()
Creates a matcher that matches when the examined date is yesterday
For example:
|
static org.hamcrest.Matcher<LocalDate> |
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<LocalDate> |
sameDayOfMonth(LocalDate 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<LocalDate> |
sameDayOfWeek(LocalDate 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<LocalDate> |
sameMonthOfYear(LocalDate 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<LocalDate> |
sameOrAfter(int year,
Month month,
int day)
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<LocalDate> |
sameOrAfter(LocalDate date)
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<LocalDate> |
sameOrBefore(int year,
Month month,
int day)
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<LocalDate> |
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<LocalDate> |
sameYear(LocalDate 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<LocalDate> |
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<LocalDate> |
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:
|
public static org.hamcrest.Matcher<LocalDate> after(LocalDate date)
MatcherAssert.assertThat(myDate, LocalDateMatchers.after(LocalDate.now()));
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> after(int year, Month month, int dayOfMonth)
MatcherAssert.assertThat(myDate, LocalDateMatchers.after(2012, Month.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<LocalDate> before(LocalDate date)
MatcherAssert.assertThat(myDate, LocalDateMatchers.before(LocalDate.now()));
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> before(int year, Month month, int dayOfMonth)
MatcherAssert.assertThat(myDate, LocalDateMatchers.before(2012, Month.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<LocalDate> sameDay(LocalDate date)
assertThat(myDate, sameDay(LocalDate.now()));
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> isDay(int year, Month month, int dayOfMonth)
assertThat(myDate, isDay(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 checkedpublic static org.hamcrest.Matcher<LocalDate> sameOrBefore(LocalDate date)
assertThat(myDate, isSameOrBefore(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> sameOrBefore(int year, Month month, int day)
assertThat(myDate, isSameOrBefore(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<LocalDate> sameOrAfter(LocalDate date)
assertThat(myDate, isSameOrAfter(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> sameOrAfter(int year, Month month, int day)
assertThat(myDate, isSameOrAfter(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<LocalDate> sameMonthOfYear(LocalDate date)
assertThat(myDate, sameMonth(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> sameDayOfMonth(LocalDate date)
assertThat(myDate, sameDayOfMonth(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> isDayOfMonth(int dayOfMonth)
assertThat(myDate, isDayOfMonth(4))
date - the expected day of the monthpublic static org.hamcrest.Matcher<LocalDate> sameYear(LocalDate date)
assertThat(myDate, sameYear(new Date()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> isYear(int year)
assertThat(myDate, sameYear(2013))
year - the reference year against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> within(long period, ChronoUnit unit, LocalDate date)
assertThat(myDate, within(10, TimeUnit.DAYS, Moments.today()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> 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
checkedpublic static org.hamcrest.Matcher<LocalDate> isYesterday()
assertThat(myDate, isToday());
public static org.hamcrest.Matcher<LocalDate> isToday()
assertThat(myDate, isToday());
public static org.hamcrest.Matcher<LocalDate> isTomorrow()
assertThat(myDate, isTomorrow());
public static org.hamcrest.Matcher<LocalDate> sameDayOfWeek(LocalDate date)
assertThat(myDate, sameDayOfWeek(LocalDate.now()))
date - the reference date against which the examined date is checkedpublic static org.hamcrest.Matcher<LocalDate> isDayOfWeek(DayOfWeek... dayOfWeek)
assertThat(myDate, isMonday());
public static org.hamcrest.Matcher<LocalDate> isMonday()
assertThat(myDate, isMonday());
public static org.hamcrest.Matcher<LocalDate> isTuesday()
assertThat(myDate, isTuesday());
public static org.hamcrest.Matcher<LocalDate> isWednesday()
assertThat(myDate, isWednesday());
public static org.hamcrest.Matcher<LocalDate> isThursday()
assertThat(myDate, isThursday());
public static org.hamcrest.Matcher<LocalDate> isFriday()
assertThat(myDate, isFriday());
public static org.hamcrest.Matcher<LocalDate> isSaturday()
assertThat(myDate, isSaturday());
public static org.hamcrest.Matcher<LocalDate> isSunday()
assertThat(myDate, isSunday());
public static org.hamcrest.Matcher<LocalDate> isWeekday()
assertThat(myDate, isWeekday());
public static org.hamcrest.Matcher<LocalDate> isWeekend()
assertThat(myDate, isWeekend());
public static org.hamcrest.Matcher<LocalDate> isFirstDayOfMonth()
assertThat(myDate, isFirstDayOfMonth());
public static org.hamcrest.Matcher<LocalDate> isMinimum(TemporalField field)
assertThat(myDate, isMaximumDayOfMonth(ChronoField.DAY_OF_MONTH));
field - the temporal field to checkpublic static org.hamcrest.Matcher<LocalDate> isLastDayOfMonth()
assertThat(myDate, isFirstDayOfMonth());
public static org.hamcrest.Matcher<LocalDate> isMaximum(TemporalField field)
assertThat(myDate, isMaximum(ChronoField.DAY_OF_MONTH));
field - the temporal field to checkpublic static org.hamcrest.Matcher<LocalDate> isMonth(Month month)
assertThat(myDate, isMonth(Month.AUGUST));
public static org.hamcrest.Matcher<LocalDate> isJanuary()
assertThat(myDate, isJanuary());
public static org.hamcrest.Matcher<LocalDate> isFebruary()
assertThat(myDate, isFebruary());
public static org.hamcrest.Matcher<LocalDate> isMarch()
assertThat(myDate, isMarch());
public static org.hamcrest.Matcher<LocalDate> isApril()
assertThat(myDate, isApril());
public static org.hamcrest.Matcher<LocalDate> isMay()
assertThat(myDate, isMay());
public static org.hamcrest.Matcher<LocalDate> isJune()
assertThat(myDate, isJune());
public static org.hamcrest.Matcher<LocalDate> isJuly()
assertThat(myDate, isJuly());
public static org.hamcrest.Matcher<LocalDate> isAugust()
assertThat(myDate, isAugust());
public static org.hamcrest.Matcher<LocalDate> isSeptember()
assertThat(myDate, isSeptember());
public static org.hamcrest.Matcher<LocalDate> isOctober()
assertThat(myDate, isOctober());
public static org.hamcrest.Matcher<LocalDate> isNovember()
assertThat(myDate, isNovember());
public static org.hamcrest.Matcher<LocalDate> isDecember()
assertThat(myDate, isDecember());
public static org.hamcrest.Matcher<LocalDate> isLeapYear()
assertThat(myDate, isLeapYear());
Copyright © 2015. All rights reserved.