public class DateTimeAssert extends org.assertj.core.api.AbstractAssert<DateTimeAssert,org.joda.time.DateTime>
DateTime
type.Modifier and Type | Field and Description |
---|---|
static String |
NULL_DATE_TIME_PARAMETER_MESSAGE |
Modifier | Constructor and Description |
---|---|
protected |
DateTimeAssert(Class<DateTimeAssert> selfType,
org.joda.time.DateTime actual)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
protected org.joda.time.DateTime |
getActual() |
DateTimeAssert |
isAfter(org.joda.time.DateTime other)
Verifies that the actual
DateTime is strictly after the given one. |
DateTimeAssert |
isAfter(String dateTimeAsString)
Same assertion as
isAfter(DateTime) but the DateTime is built from given String, which must follow
ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isAfterOrEqualTo(org.joda.time.DateTime other)
Verifies that the actual
DateTime is after or equals to the given one. |
DateTimeAssert |
isAfterOrEqualTo(String dateTimeAsString)
Same assertion as
isAfterOrEqualTo(DateTime) but the DateTime is built from given String, which
must follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isBefore(org.joda.time.DateTime other)
Verifies that the actual
DateTime is strictly before the given one. |
DateTimeAssert |
isBefore(String dateTimeAsString)
Same assertion as
isBefore(DateTime) but the DateTime is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isBeforeOrEqualTo(org.joda.time.DateTime other)
Verifies that the actual
DateTime is before or equals to the given one. |
DateTimeAssert |
isBeforeOrEqualTo(String dateTimeAsString)
Same assertion as
isBeforeOrEqualTo(DateTime) but the DateTime is built from given String, which
must follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isEqualTo(String dateTimeAsString)
Same assertion as
#isEqualTo(DateTime) but the DateTime is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isEqualToIgnoringHours(org.joda.time.DateTime other)
Verifies that actual and given
DateTime have same year, month and day fields (hour, minute, second and
millisecond fields are ignored in comparison). |
DateTimeAssert |
isEqualToIgnoringMillis(org.joda.time.DateTime other)
Verifies that actual and given
DateTime have same year, month, day, hour, minute and second fields,
(millisecond fields are ignored in comparison). |
DateTimeAssert |
isEqualToIgnoringMinutes(org.joda.time.DateTime other)
Verifies that actual and given
DateTime have same year, month, day and hour fields (minute, second and
millisecond fields are ignored in comparison). |
DateTimeAssert |
isEqualToIgnoringSeconds(org.joda.time.DateTime other)
Verifies that actual and given
DateTime have same year, month, day, hour and minute fields (second and
millisecond fields are ignored in comparison). |
DateTimeAssert |
isIn(String... dateTimesAsString)
Same assertion as
#isIn(DateTime...) but the DateTime are built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isNotEqualTo(String dateTimeAsString)
Same assertion as
#isNotEqualTo(DateTime) but the DateTime is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object) constructor. |
DateTimeAssert |
isNotIn(String... dateTimesAsString)
Same assertion as
#isIn(DateTime) but the DateTime is built from given String, which must follow ISO DateTime format to allow calling DateTime(Object) constructor. |
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
public static final String NULL_DATE_TIME_PARAMETER_MESSAGE
protected DateTimeAssert(Class<DateTimeAssert> selfType, org.joda.time.DateTime actual)
org.assertj.jodatime.api.AbstractAssert
.selfType
- the "self type"actual
- the actual value to verifyprotected org.joda.time.DateTime getActual()
public DateTimeAssert isBefore(org.joda.time.DateTime other)
DateTime
is strictly before the given one.other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is not strictly before the given one.public DateTimeAssert isBefore(String dateTimeAsString)
isBefore(DateTime)
but the DateTime
is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not strictly before the DateTime
built from given
String.public DateTimeAssert isBeforeOrEqualTo(org.joda.time.DateTime other)
DateTime
is before or equals to the given one.other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is not before or equals to the given one.public DateTimeAssert isBeforeOrEqualTo(String dateTimeAsString)
isBeforeOrEqualTo(DateTime)
but the DateTime
is built from given String, which
must follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not before or equals to the DateTime
built from
given String.public DateTimeAssert isAfterOrEqualTo(org.joda.time.DateTime other)
DateTime
is after or equals to the given one.other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is not after or equals to the given one.public DateTimeAssert isAfterOrEqualTo(String dateTimeAsString)
isAfterOrEqualTo(DateTime)
but the DateTime
is built from given String, which
must follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not after or equals to the DateTime
built from
given String.public DateTimeAssert isAfter(org.joda.time.DateTime other)
DateTime
is strictly after the given one.other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is not strictly after the given one.public DateTimeAssert isAfter(String dateTimeAsString)
isAfter(DateTime)
but the DateTime
is built from given String, which must follow
ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not strictly after the DateTime
built from given
String.public DateTimeAssert isEqualToIgnoringMillis(org.joda.time.DateTime other)
DateTime
have same year, month, day, hour, minute and second fields,
(millisecond fields are ignored in comparison).
Assertion can fail with dateTimes in same chronological millisecond time window, e.g :
2000-01-01T00:00:01.000 and 2000-01-01T00:00:00.999.
Assertion fails as second fields differ even if time difference is only 1ms.
Code example :
// successfull assertions DateTime dateTime1 = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 0, 0, 1, 456); assertThat(dateTime1).isEqualToIgnoringMillis(dateTime2); // failing assertions (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 0, 0, 1, 0); DateTime dateTimeB = new DateTime(2000, 1, 1, 0, 0, 0, 999); assertThat(dateTimeA).isEqualToIgnoringMillis(dateTimeB);
other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is are not equal with milliseconds ignored.public DateTimeAssert isEqualToIgnoringSeconds(org.joda.time.DateTime other)
DateTime
have same year, month, day, hour and minute fields (second and
millisecond fields are ignored in comparison).
Assertion can fail with DateTimes in same chronological second time window, e.g :
2000-01-01T00:01:00.000 and 2000-01-01T00:00:59.000.
Assertion fails as minute fields differ even if time difference is only 1s.
Code example :
// successfull assertions DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 50, 10, 456); assertThat(dateTime1).isEqualToIgnoringSeconds(dateTime2); // failing assertions (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 23, 50, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 49, 59, 999); assertThat(dateTimeA).isEqualToIgnoringSeconds(dateTimeB);
other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is are not equal with second and millisecond fields ignored.public DateTimeAssert isEqualToIgnoringMinutes(org.joda.time.DateTime other)
DateTime
have same year, month, day and hour fields (minute, second and
millisecond fields are ignored in comparison).
Assertion can fail with dateTimes in same chronological second time window, e.g :
2000-01-01T01:00:00.000 and 2000-01-01T00:59:59.000.
Time difference is only 1s but hour fields differ.
Code example :
// successfull assertions DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 50, 0, 0); DateTime dateTime2 = new DateTime(2000, 1, 1, 23, 00, 2, 7); assertThat(dateTime1).isEqualToIgnoringMinutes(dateTime2); // failing assertions (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 1, 01, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 00, 59, 59, 999); assertThat(dateTimeA).isEqualToIgnoringMinutes(dateTimeB);
other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is are not equal ignoring minute, second and millisecond fields.public DateTimeAssert isEqualToIgnoringHours(org.joda.time.DateTime other)
DateTime
have same year, month and day fields (hour, minute, second and
millisecond fields are ignored in comparison).
Assertion can fail with dateTimes in same chronological minute time window, e.g :
2000-01-01T23:59:00.000 and 2000-01-02T00:00:00.000.
Time difference is only 1min but day fields differ.
Code example :
// successfull assertions DateTime dateTime1 = new DateTime(2000, 1, 1, 23, 59, 59, 999); DateTime dateTime2 = new DateTime(2000, 1, 1, 00, 00, 00, 000); assertThat(dateTime1).isEqualToIgnoringHours(dateTime2); // failing assertions (even if time difference is only 1ms) DateTime dateTimeA = new DateTime(2000, 1, 2, 00, 00, 00, 000); DateTime dateTimeB = new DateTime(2000, 1, 1, 23, 59, 59, 999); assertThat(dateTimeA).isEqualToIgnoringHours(dateTimeB);
other
- the given DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if other DateTime
is null
.AssertionError
- if the actual DateTime
is are not equal with second and millisecond fields ignored.public DateTimeAssert isEqualTo(String dateTimeAsString)
#isEqualTo(DateTime)
but the DateTime
is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not equal to the DateTime
built from given String.public DateTimeAssert isNotEqualTo(String dateTimeAsString)
#isNotEqualTo(DateTime)
but the DateTime
is built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
created from the given String is built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is equal to the DateTime
built from given String.public DateTimeAssert isIn(String... dateTimesAsString)
#isIn(DateTime...)
but the DateTime
are built from given String, which must
follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
s created from the given Strings are built in the DateTimeZone
of actual
DateTime
.
dateTimesAsString
- String array representing DateTime
s.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not in the DateTime
s built from given Strings.public DateTimeAssert isNotIn(String... dateTimesAsString)
#isIn(DateTime)
but the DateTime
is built from given String, which must follow ISO DateTime format to allow calling DateTime(Object)
constructor.
Note that the DateTime
s created from the given Strings are built in the DateTimeZone
of actual
DateTime
.
dateTimeAsString
- String representing a DateTime
.AssertionError
- if the actual DateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a DateTime
.AssertionError
- if the actual DateTime
is not equal to the DateTime
built from given String.Copyright © 2013 AssertJ. All Rights Reserved.