SELF
- the "self" type of this assertion class.public abstract class AbstractOffsetDateTimeAssert<SELF extends AbstractOffsetDateTimeAssert<SELF>> extends AbstractTemporalAssert<SELF,OffsetDateTime>
OffsetDateTime
type from new Date & Time API introduced in Java 8.Modifier and Type | Field and Description |
---|---|
static String |
NULL_OFFSET_DATE_TIME_PARAMETER_MESSAGE |
actual, info, myself, throwUnsupportedExceptionOnEquals
Modifier | Constructor and Description |
---|---|
protected |
AbstractOffsetDateTimeAssert(OffsetDateTime actual,
Class<?> selfType)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
SELF |
isAfter(OffsetDateTime other)
Verifies that the actual
OffsetDateTime is strictly after the given one. |
SELF |
isAfter(String offsetDateTimeAsString)
Same assertion as
isAfter(java.time.OffsetDateTime) but the OffsetDateTime is built from
given a String that
must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isAfterOrEqualTo(OffsetDateTime other)
Verifies that the actual
OffsetDateTime is after or equals to the given one. |
SELF |
isAfterOrEqualTo(String offsetDateTimeAsString)
Same assertion as
isAfterOrEqualTo(java.time.OffsetDateTime) but the OffsetDateTime is
built from given
String, which must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isBefore(OffsetDateTime other)
Verifies that the actual
OffsetDateTime is strictly before the given one. |
SELF |
isBefore(String offsetDateTimeAsString)
Same assertion as
isBefore(java.time.OffsetDateTime) but the OffsetDateTime is built
from given String, which
must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isBeforeOrEqualTo(OffsetDateTime other)
Verifies that the actual
OffsetDateTime is before or equals to the given one. |
SELF |
isBeforeOrEqualTo(String offsetDateTimeAsString)
Same assertion as
isBeforeOrEqualTo(java.time.OffsetDateTime) but the OffsetDateTime is
built from given
String, which must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isBetween(OffsetDateTime startExclusive,
OffsetDateTime endExclusive)
Verifies that the actual
OffsetDateTime is in the [start, end] period (start and end included). |
SELF |
isBetween(String startExclusive,
String endExclusive)
Same assertion as
isBetween(OffsetDateTime, OffsetDateTime) but here you pass OffsetDateTime String representations
which must follow ISO OffsetDateTime format
to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isEqualTo(String dateTimeAsString)
Same assertion as
AbstractAssert.isEqualTo(Object) (where Object is expected to be OffsetDateTime ) but
here you
pass OffsetDateTime String representation that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isEqualToIgnoringHours(OffsetDateTime other)
Verifies that actual and given
OffsetDateTime have same year, month and day fields (hour, minute, second
and nanosecond fields are ignored in comparison). |
SELF |
isEqualToIgnoringMinutes(OffsetDateTime other)
Verifies that actual and given
OffsetDateTime have same year, month, day and hour fields (minute, second
and
nanosecond fields are ignored in comparison). |
SELF |
isEqualToIgnoringNanos(OffsetDateTime other)
Verifies that actual and given
OffsetDateTime have same year, month, day, hour, minute and second fields,
(nanosecond fields are ignored in comparison). |
SELF |
isEqualToIgnoringSeconds(OffsetDateTime other)
Verifies that actual and given
OffsetDateTime have same year, month, day, hour and minute fields
(second and
nanosecond fields are ignored in comparison). |
SELF |
isEqualToIgnoringTimezone(OffsetDateTime other)
Verifies that actual and given
OffsetDateTime have same year, month, day, hour, minute, second and
nanosecond fields,
(timezone fields are ignored in comparison). |
SELF |
isIn(String... dateTimesAsString)
Same assertion as
AbstractAssert.isIn(Object...) (where Objects are expected to be OffsetDateTime ) but
here you
pass OffsetDateTime String representations that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isNotEqualTo(String dateTimeAsString)
Same assertion as
AbstractAssert.isNotEqualTo(Object) (where Object is expected to be OffsetDateTime )
but here you
pass OffsetDateTime String representation that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isNotIn(String... dateTimesAsString)
Same assertion as
AbstractAssert.isNotIn(Object...) (where Objects are expected to be OffsetDateTime )
but here you
pass OffsetDateTime String representations that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence) method. |
SELF |
isStrictlyBetween(OffsetDateTime startExclusive,
OffsetDateTime endExclusive)
Verifies that the actual
OffsetDateTime is in the ]start, end[ period (start and end excluded). |
SELF |
isStrictlyBetween(String startExclusive,
String endExclusive)
Same assertion as
isStrictlyBetween(OffsetDateTime, OffsetDateTime) but here you pass OffsetDateTime String representations
which must follow ISO OffsetDateTime format
to allow calling OffsetDateTime.parse(CharSequence) method. |
protected OffsetDateTime |
parse(String offsetDateTimeAsString)
Obtains an instance of
TEMPORAL from a string representation in ISO date format. |
getActual, isCloseTo, isCloseTo
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, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
public static final String NULL_OFFSET_DATE_TIME_PARAMETER_MESSAGE
protected AbstractOffsetDateTimeAssert(OffsetDateTime actual, Class<?> selfType)
AbstractOffsetDateTimeAssert
.selfType
- the "self type"actual
- the actual value to verifypublic SELF isBefore(OffsetDateTime other)
OffsetDateTime
is strictly before the given one.
Example :
assertThat(parse("2000-01-01T23:59:59Z")).isBefore(parse("2000-01-02T00:00:00Z"));
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is not strictly before the given one.public SELF isBefore(String offsetDateTimeAsString)
isBefore(java.time.OffsetDateTime)
but the OffsetDateTime
is built
from given String, which
must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid writing the code to perform the conversion
assertThat(parse("2000-01-01T23:59:59Z")).isBefore("2000-01-02T00:00:00Z");
offsetDateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not strictly before the
OffsetDateTime
built
from given String.public SELF isBeforeOrEqualTo(OffsetDateTime other)
OffsetDateTime
is before or equals to the given one.
Example :
assertThat(parse("2000-01-01T23:59:59Z")).isBeforeOrEqualTo(parse("2000-01-01T23:59:59Z"))
.isBeforeOrEqualTo(parse("2000-01-02T00:00:00Z"));
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is not before or equals to the given one.public SELF isBeforeOrEqualTo(String offsetDateTimeAsString)
isBeforeOrEqualTo(java.time.OffsetDateTime)
but the OffsetDateTime
is
built from given
String, which must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid conversion
assertThat(parse("2000-01-01T23:59:59Z")).isBeforeOrEqualTo("2000-01-01T23:59:59Z")
.isBeforeOrEqualTo("2000-01-02T00:00:00Z");
offsetDateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not before or equals to the
OffsetDateTime
built from given String.public SELF isAfterOrEqualTo(OffsetDateTime other)
OffsetDateTime
is after or equals to the given one.
Example :
assertThat(parse("2000-01-01T00:00:00Z")).isAfterOrEqualTo(parse("2000-01-01T00:00:00Z"))
.isAfterOrEqualTo(parse("1999-12-31T23:59:59Z"));
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is not after or equals to the given one.public SELF isAfterOrEqualTo(String offsetDateTimeAsString)
isAfterOrEqualTo(java.time.OffsetDateTime)
but the OffsetDateTime
is
built from given
String, which must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid conversion
assertThat(parse("2000-01-01T00:00:00Z")).isAfterOrEqualTo("2000-01-01T00:00:00Z")
.isAfterOrEqualTo("1999-12-31T23:59:59Z");
offsetDateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not after or equals to the
OffsetDateTime
built from given String.public SELF isAfter(OffsetDateTime other)
OffsetDateTime
is strictly after the given one.
Example :
assertThat(parse("2000-01-01T00:00:00Z")).isAfter(parse("1999-12-31T23:59:59Z"));
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is not strictly after the given one.public SELF isAfter(String offsetDateTimeAsString)
isAfter(java.time.OffsetDateTime)
but the OffsetDateTime
is built from
given a String that
must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid conversion
assertThat(parse("2000-01-01T00:00:00Z")).isAfter("1999-12-31T23:59:59Z");
offsetDateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not strictly after the
OffsetDateTime
built from given String.public SELF isEqualTo(String dateTimeAsString)
AbstractAssert.isEqualTo(Object)
(where Object is expected to be OffsetDateTime
) but
here you
pass OffsetDateTime
String representation that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid writing the code to perform the conversion
assertThat(parse("2000-01-01T00:00:00Z")).isEqualTo("2000-01-01T00:00:00Z");
dateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not equal to the OffsetDateTime
built from given String.public SELF isNotEqualTo(String dateTimeAsString)
AbstractAssert.isNotEqualTo(Object)
(where Object is expected to be OffsetDateTime
)
but here you
pass OffsetDateTime
String representation that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String in comparison to avoid writing the code to perform the conversion
assertThat(parse("2000-01-01T00:00:00Z")).isNotEqualTo("2000-01-15T00:00:00Z");
dateTimeAsString
- String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is equal to the OffsetDateTime
built
from given String.public SELF isIn(String... dateTimesAsString)
AbstractAssert.isIn(Object...)
(where Objects are expected to be OffsetDateTime
) but
here you
pass OffsetDateTime
String representations that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String based representation of OffsetDateTime
assertThat(parse("2000-01-01T00:00:00Z")).isIn("1999-12-31T00:00:00Z", "2000-01-01T00:00:00Z");
dateTimesAsString
- String array representing OffsetDateTime
s.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is not in the OffsetDateTime
s built
from given Strings.public SELF isNotIn(String... dateTimesAsString)
AbstractAssert.isNotIn(Object...)
(where Objects are expected to be OffsetDateTime
)
but here you
pass OffsetDateTime
String representations that must follow ISO OffsetDateTime format to allow calling OffsetDateTime.parse(CharSequence)
method.
Example :
// use String based representation of OffsetDateTime
assertThat(parse("2000-01-01T00:00:00Z")).isNotIn("1999-12-31T00:00:00Z", "2000-01-02T00:00:00Z");
dateTimesAsString
- Array of String representing a OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if given String is null or can't be converted to a
OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is in the OffsetDateTime
s built from
given Strings.public SELF isEqualToIgnoringNanos(OffsetDateTime other)
OffsetDateTime
have same year, month, day, hour, minute and second fields,
(nanosecond fields are ignored in comparison).
Assertion can fail with OffsetDateTimes in same chronological nanosecond time window, e.g :
2000-01-01T00:00:01.000000000+01:00 and 2000-01-01T00:00:00.999999999+01:00.
Assertion fails as second fields differ even if time difference is only 1ns.
Code example :
// successful assertions
OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 456, ZoneOffset.UTC);
assertThat(OffsetDateTime1).isEqualToIgnoringNanos(OffsetDateTime2);
// failing assertions (even if time difference is only 1ns)
OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 999999999, ZoneOffset.UTC);
assertThat(OffsetDateTimeA).isEqualToIgnoringNanos(OffsetDateTimeB);
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is are not equal with nanoseconds ignored.public SELF isEqualToIgnoringTimezone(OffsetDateTime other)
OffsetDateTime
have same year, month, day, hour, minute, second and
nanosecond fields,
(timezone fields are ignored in comparison).
Code example :
// successful assertions
OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.MAX);
assertThat(OffsetDateTime1).isEqualToIgnoringTimezone(OffsetDateTime2);
// failing assertions
OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 999999999, ZoneOffset.UTC);
assertThat(OffsetDateTimeA).isEqualToIgnoringTimezone(OffsetDateTimeB);
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is are not equal with timezone ignored.public SELF isEqualToIgnoringSeconds(OffsetDateTime other)
OffsetDateTime
have same year, month, day, hour and minute fields
(second and
nanosecond fields are ignored in comparison).
Assertion can fail with OffsetDateTimes in same chronological second time window, e.g :
2000-01-01T00:01:00.000+01:00 and 2000-01-01T00:00:59.000+01:00.
Assertion fails as minute fields differ even if time difference is only 1s.
Code example :
// successful assertions
OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 50, 0, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 23, 50, 10, 456, ZoneOffset.UTC);
assertThat(OffsetDateTime1).isEqualToIgnoringSeconds(OffsetDateTime2);
// failing assertions (even if time difference is only 1ms)
OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 23, 50, 00, 000, ZoneOffset.UTC);
OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 23, 49, 59, 999, ZoneOffset.UTC);
assertThat(OffsetDateTimeA).isEqualToIgnoringSeconds(OffsetDateTimeB);
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is are not equal with second and nanosecond fields
ignored.public SELF isEqualToIgnoringMinutes(OffsetDateTime other)
OffsetDateTime
have same year, month, day and hour fields (minute, second
and
nanosecond fields are ignored in comparison).
Assertion can fail with OffsetDateTimes in same chronological second time window, e.g :
2000-01-01T01:00:00.000+01:00 and 2000-01-01T00:59:59.000+01:00.
Time difference is only 1s but hour fields differ.
Code example :
// successful assertions
OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 50, 0, 0, ZoneOffset.UTC);
OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 23, 00, 2, 7, ZoneOffset.UTC);
assertThat(OffsetDateTime1).isEqualToIgnoringMinutes(OffsetDateTime2);
// failing assertions (even if time difference is only 1ms)
OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 01, 00, 00, 000, ZoneOffset.UTC);
OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 00, 59, 59, 999, ZoneOffset.UTC);
assertThat(OffsetDateTimeA).isEqualToIgnoringMinutes(OffsetDateTimeB);
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is are not equal ignoring minute, second and nanosecond
fields.public SELF isEqualToIgnoringHours(OffsetDateTime other)
OffsetDateTime
have same year, month and day fields (hour, minute, second
and nanosecond fields are ignored in comparison).
Assertion can fail with OffsetDateTimes in same chronological minute time window, e.g :
2000-01-01T23:59:00.000+01:00 and 2000-01-02T00:00:00.000+01:00.
Time difference is only 1min but day fields differ.
Code example :
// successful assertions
OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 59, 59, 999, ZoneOffset.UTC);
OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 00, 00, 00, 000, ZoneOffset.UTC);
assertThat(OffsetDateTime1).isEqualToIgnoringHours(OffsetDateTime2);
// failing assertions (even if time difference is only 1ms)
OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 2, 00, 00, 00, 000, ZoneOffset.UTC);
OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 23, 59, 59, 999, ZoneOffset.UTC);
assertThat(OffsetDateTimeA).isEqualToIgnoringHours(OffsetDateTimeB);
other
- the given OffsetDateTime
.AssertionError
- if the actual OffsetDateTime
is null
.IllegalArgumentException
- if other OffsetDateTime
is null
.AssertionError
- if the actual OffsetDateTime
is are not equal with second and nanosecond fields
ignored.public SELF isBetween(OffsetDateTime startExclusive, OffsetDateTime endExclusive)
OffsetDateTime
is in the [start, end] period (start and end included).
Example:
OffsetDateTime offsetDateTime = OffsetDateTime.now();
// assertions succeed:
assertThat(offsetDateTime).isBetween(offsetDateTime.minusSeconds(1), offsetDateTime.plusSeconds(1))
.isBetween(offsetDateTime, offsetDateTime.plusSeconds(1))
.isBetween(offsetDateTime.minusSeconds(1), offsetDateTime)
.isBetween(offsetDateTime, offsetDateTime);
// assertions fail:
assertThat(offsetDateTime).isBetween(offsetDateTime.minusSeconds(10), offsetDateTime.minusSeconds(1));
assertThat(offsetDateTime).isBetween(offsetDateTime.plusSeconds(1), offsetDateTime.plusSeconds(10));
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.AssertionError
- if the actual value is null
.NullPointerException
- if start value is null
.NullPointerException
- if end value is null
.AssertionError
- if the actual value is not in [start, end] period.public SELF isBetween(String startExclusive, String endExclusive)
isBetween(OffsetDateTime, OffsetDateTime)
but here you pass OffsetDateTime
String representations
which must follow ISO OffsetDateTime format
to allow calling OffsetDateTime.parse(CharSequence)
method.
Example:
OffsetDateTime firstOfJanuary2000 = OffsetDateTime.parse("2000-01-01T00:00:00Z");
// assertions succeed:
assertThat(firstOfJanuary2000).isBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:01Z")
.isBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:01Z")
.isBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:00Z")
.isBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:00Z");
// assertion fails:
assertThat(firstOfJanuary2000).isBetween("1999-01-01T00:00:01Z", "1999-12-31T23:59:59Z");
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.AssertionError
- if the actual value is null
.NullPointerException
- if start value is null
.NullPointerException
- if end value is null
.DateTimeParseException
- if any of the given String can't be converted to a OffsetDateTime
.AssertionError
- if the actual value is not in [start, end] period.public SELF isStrictlyBetween(OffsetDateTime startExclusive, OffsetDateTime endExclusive)
OffsetDateTime
is in the ]start, end[ period (start and end excluded).
Example:
OffsetDateTime offsetDateTime = OffsetDateTime.now();
// assertion succeeds:
assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(1), offsetDateTime.plusSeconds(1));
// assertions fail:
assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(10), offsetDateTime.minusSeconds(1));
assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.plusSeconds(1), offsetDateTime.plusSeconds(10));
assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime, offsetDateTime.plusSeconds(1));
assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(1), offsetDateTime);
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.AssertionError
- if the actual value is null
.NullPointerException
- if start value is null
.NullPointerException
- if end value is null
.AssertionError
- if the actual value is not in ]start, end[ period.public SELF isStrictlyBetween(String startExclusive, String endExclusive)
isStrictlyBetween(OffsetDateTime, OffsetDateTime)
but here you pass OffsetDateTime
String representations
which must follow ISO OffsetDateTime format
to allow calling OffsetDateTime.parse(CharSequence)
method.
Example:
OffsetDateTime firstOfJanuary2000 = OffsetDateTime.parse("2000-01-01T00:00:00Z");
// assertion succeeds:
assertThat(firstOfJanuary2000).isStrictlyBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:01Z");
// assertions fail:
assertThat(firstOfJanuary2000).isStrictlyBetween("1999-01-01T00:00:01Z", "1999-12-31T23:59:59Z");
assertThat(firstOfJanuary2000).isStrictlyBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:01Z");
assertThat(firstOfJanuary2000).isStrictlyBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:00Z");
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.AssertionError
- if the actual value is null
.NullPointerException
- if start value is null
.NullPointerException
- if end value is null
.DateTimeParseException
- if any of the given String can't be converted to a OffsetDateTime
.AssertionError
- if the actual value is not in ]start, end[ period.protected OffsetDateTime parse(String offsetDateTimeAsString)
TEMPORAL
from a string representation in ISO date format.parse
in class AbstractTemporalAssert<SELF extends AbstractOffsetDateTimeAssert<SELF>,OffsetDateTime>
offsetDateTimeAsString
- the string to parse, not nullTEMPORAL
, not nullCopyright © 2014–2019 AssertJ. All rights reserved.