public class LocalDateAssert extends org.assertj.core.api.AbstractAssert<LocalDateAssert,org.joda.time.LocalDate>
LocalDate
type.Modifier and Type | Field and Description |
---|---|
static String |
NULL_LOCAL_DATE_PARAMETER_MESSAGE |
Modifier | Constructor and Description |
---|---|
protected |
LocalDateAssert(Class<LocalDateAssert> selfType,
org.joda.time.LocalDate actual)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
protected org.joda.time.LocalDate |
getActual() |
LocalDateAssert |
hasDayOfMonth(int expectedDayOfMonth)
Verifies that the month of the actual
LocalDate is equal to the given month |
LocalDateAssert |
hasMonthOfYear(int expectedMonthOfYear)
Verifies that the month of the actual
LocalDate is equal to the given month |
LocalDateAssert |
hasYear(int expectedYear)
Verifies that the year of the actual
LocalDate is equal to the given year |
LocalDateAssert |
isAfter(org.joda.time.LocalDate other)
Verifies that the actual
LocalDate is strictly after the given one. |
LocalDateAssert |
isAfter(String localDateAsString)
Same assertion as
isAfter(LocalDate) but the LocalDate is built from given a String that
must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor. |
LocalDateAssert |
isAfterOrEqualTo(org.joda.time.LocalDate other)
Verifies that the actual
LocalDate is after or equals to the given one. |
LocalDateAssert |
isAfterOrEqualTo(String LocalDateAsString)
Same assertion as
isAfterOrEqualTo(LocalDate) but the LocalDate is built from given
String, which must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor. |
LocalDateAssert |
isBefore(org.joda.time.LocalDate other)
Verifies that the actual
LocalDate is strictly before the given one. |
LocalDateAssert |
isBefore(String LocalDateAsString)
Same assertion as
isBefore(LocalDate) but the LocalDate is built from given String, which
must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor. |
LocalDateAssert |
isBeforeOrEqualTo(org.joda.time.LocalDate other)
Verifies that the actual
LocalDate is before or equals to the given one. |
LocalDateAssert |
isBeforeOrEqualTo(String LocalDateAsString)
Same assertion as
isBeforeOrEqualTo(LocalDate) but the LocalDate is built from given
String, which must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor. |
LocalDateAssert |
isEqualTo(String localDateString)
Same assertion as
AbstractAssert.isEqualTo(Object) (where Object is expected to be LocalDate ) but here you
pass LocalDate String representation that must follow ISO8601 format (yyyy-MM-dd)
to allow calling LocalDate(Object) constructor. |
LocalDateAssert |
isIn(String... localDatesAsString)
Same assertion as
AbstractAssert.isIn(Object...) (where Objects are expected to be LocalDate ) but here you
pass LocalDate String representations that must followISO8601 format (yyyy-MM-dd) to allow calling
LocalDate(Object) constructor. |
LocalDateAssert |
isNotEqualTo(String localDateAsString)
Same assertion as
AbstractAssert.isNotEqualTo(Object) (where Object is expected to be LocalDate ) but here you
pass LocalDate String representation that must follow ISO8601 format (yyyy-MM-dd) to
allow calling LocalDate(Object) constructor. |
LocalDateAssert |
isNotIn(String... localDatesAsString)
Same assertion as
AbstractAssert.isNotIn(Object...) (where Objects are expected to be LocalDate ) but here you
pass LocalDate String representations that must follow ISO8601 format (yyyy-MM-dd)
to allow calling LocalDate(Object) constructor. |
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
public static final String NULL_LOCAL_DATE_PARAMETER_MESSAGE
protected LocalDateAssert(Class<LocalDateAssert> selfType, org.joda.time.LocalDate actual)
LocalDateAssert
.selfType
- the "self type"actual
- the actual value to verifyprotected org.joda.time.LocalDate getActual()
public LocalDateAssert hasYear(int expectedYear)
LocalDate
is equal to the given year
Example :
assertThat(new LocalDate(2018,3,4)).hasYear(2018);
expectedYear
- the given year.AssertionError
- if the actual LocalDate
is null
.AssertionError
- if the year of the actual LocalDate
is not equal to the given year.public LocalDateAssert hasMonthOfYear(int expectedMonthOfYear)
LocalDate
is equal to the given month
Example :
assertThat(new LocalDate(2018,3,4)).hasMonthOfYear(3);
expectedMonthOfYear
- the given month, from 1 to 12AssertionError
- if the actual LocalDate
is null
.AssertionError
- if the month of the actual LocalDate
is not equal to the given month.public LocalDateAssert hasDayOfMonth(int expectedDayOfMonth)
LocalDate
is equal to the given month
Example :
assertThat(new LocalDate(2018,1,20)).hasDayOfMonth(20);
expectedDayOfMonth
- the given day of month, from 1 to 31AssertionError
- if the actual LocalDate
is null
.AssertionError
- if the day of the actual LocalDate
is not equal to the given day.public LocalDateAssert isBefore(org.joda.time.LocalDate other)
LocalDate
is strictly before the given one.
Example :
assertThat(new LocalDate(2000,1,1)).isBefore(new LocalDate(2000,1,2));
other
- the given LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if other LocalDate
is null
.AssertionError
- if the actual LocalDate
is not strictly before the given one.public LocalDateAssert isBefore(String LocalDateAsString)
isBefore(LocalDate)
but the LocalDate
is built from given String, which
must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor.
Example :
// use directly String in comparison to avoid a conversion
assertThat(new LocalDate("2000-01-01")).isBefore("2000-01-02");
LocalDateAsString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not strictly before the LocalDate
built
from given String.public LocalDateAssert isBeforeOrEqualTo(org.joda.time.LocalDate other)
LocalDate
is before or equals to the given one.
Example :
assertThat(new LocalDate("2000-01-01")).isBeforeOrEqualTo(new LocalDate("2000-01-01"))
.isBeforeOrEqualTo(new LocalDate("2000-01-02"));
other
- the given LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if other LocalDate
is null
.AssertionError
- if the actual LocalDate
is not before or equals to the given one.public LocalDateAssert isBeforeOrEqualTo(String LocalDateAsString)
isBeforeOrEqualTo(LocalDate)
but the LocalDate
is built from given
String, which must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor.
Example :
// use String in comparison to avoid conversion
assertThat(new LocalDate("2000-01-01")).isBeforeOrEqualTo("2000-01-01")
.isBeforeOrEqualTo("2000-01-02");
LocalDateAsString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not before or equals to the LocalDate
built from given String.public LocalDateAssert isAfterOrEqualTo(org.joda.time.LocalDate other)
LocalDate
is after or equals to the given one.
Example :
assertThat(new LocalDate("2000-01-01")).isAfterOrEqualTo(new LocalDate("2000-01-01"))
.isAfterOrEqualTo(new LocalDate("1999-12-31"));
other
- the given LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if other LocalDate
is null
.AssertionError
- if the actual LocalDate
is not after or equals to the given one.public LocalDateAssert isAfterOrEqualTo(String LocalDateAsString)
isAfterOrEqualTo(LocalDate)
but the LocalDate
is built from given
String, which must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor.
Example :
// use String in comparison to avoid conversion
assertThat(new LocalDate("2000-01-01")).isAfterOrEqualTo("2000-01-01")
.isAfterOrEqualTo("1999-12-31");
LocalDateAsString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not after or equals to the LocalDate
built from given String.public LocalDateAssert isAfter(org.joda.time.LocalDate other)
LocalDate
is strictly after the given one.
Example :
assertThat(new LocalDate("2000-01-01")).isAfter(new LocalDate("1999-12-31"));
other
- the given LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if other LocalDate
is null
.AssertionError
- if the actual LocalDate
is not strictly after the given one.public LocalDateAssert isAfter(String localDateAsString)
isAfter(LocalDate)
but the LocalDate
is built from given a String that
must follow ISO8601 format (yyyy-MM-dd) to allow calling LocalDate(Object)
constructor.
Example :
// use String in comparison to avoid conversion
assertThat(new LocalDate("2000-01-01")).isAfter("1999-12-31");
localDateAsString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not strictly after the LocalDate
built
from given String.public LocalDateAssert isEqualTo(String localDateString)
AbstractAssert.isEqualTo(Object)
(where Object is expected to be LocalDate
) but here you
pass LocalDate
String representation that must follow ISO8601 format (yyyy-MM-dd)
to allow calling LocalDate(Object)
constructor.
Example :
// use directly String in comparison to avoid a conversion
assertThat(new LocalDate("2000-01-01")).isEqualTo("2000-01-01");
localDateString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not equal to the LocalDate
built from
given String.public LocalDateAssert isNotEqualTo(String localDateAsString)
AbstractAssert.isNotEqualTo(Object)
(where Object is expected to be LocalDate
) but here you
pass LocalDate
String representation that must follow ISO8601 format (yyyy-MM-dd) to
allow calling LocalDate(Object)
constructor.
Example :
// use directly String in comparison to avoid a conversion
assertThat(new LocalDate("2000-01-01")).isNotEqualTo("2000-01-15");
localDateAsString
- String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is equal to the LocalDate
built from given
String.public LocalDateAssert isIn(String... localDatesAsString)
AbstractAssert.isIn(Object...)
(where Objects are expected to be LocalDate
) but here you
pass LocalDate
String representations that must followISO8601 format (yyyy-MM-dd) to allow calling
LocalDate(Object)
constructor.
Example :
// use String based representation of LocalDate
assertThat(new LocalDate("2000-01-01")).isIn("1999-12-31", "2000-01-01");
localDatesAsString
- String array representing LocalDate
s.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is not in the LocalDate
s built from given
Strings.public LocalDateAssert isNotIn(String... localDatesAsString)
AbstractAssert.isNotIn(Object...)
(where Objects are expected to be LocalDate
) but here you
pass LocalDate
String representations that must follow ISO8601 format (yyyy-MM-dd)
to allow calling LocalDate(Object)
constructor.
Example :
// use String based representation of LocalDate
assertThat(new LocalDate("2000-01-01")).isNotIn("1999-12-31", "2000-01-02");
localDatesAsString
- Array of String representing a LocalDate
.AssertionError
- if the actual LocalDate
is null
.IllegalArgumentException
- if given String is null or can't be converted to a LocalDate
.AssertionError
- if the actual LocalDate
is in the LocalDate
s built from given
Strings.Copyright © 2018 AssertJ. All rights reserved.