Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractOffsetDateTimeAssert<SELF extends AbstractOffsetDateTimeAssert<SELF>>

extends AbstractTemporalAssert<SELF extends AbstractOffsetDateTimeAssert<SELF>, OffsetDateTime>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.OffsetDateTimeAssert
Type Parameters
<SELF>
the "self" type of this assertion class.
Static Imports
java.time.Clock.systemUTC, .OffsetDateTime.now, org.assertj.core.error.ShouldBeAtSameInstant.shouldBeAtSameInstant, .ShouldBeEqualIgnoringHours.shouldBeEqualIgnoringHours, .ShouldBeEqualIgnoringMinutes.shouldBeEqualIgnoringMinutes, .ShouldBeEqualIgnoringNanos.shouldBeEqualIgnoringNanos, .ShouldBeEqualIgnoringSeconds.shouldBeEqualIgnoringSeconds, .ShouldBeEqualIgnoringTimezone.shouldBeEqualIgnoringTimezone, .ShouldBeInTheFuture.shouldBeInTheFuture, .ShouldBeInThePast.shouldBeInThePast, org.assertj.core.util.Preconditions.checkArgument

Assertions for java.time.OffsetDateTime type from new Date & Time API introduced in Java 8.
Authors
Paweł Stawicki, Joel Costigliola, Marcin Zajączkowski, Nikolaos Georgiou

Field Summary

Modifier and TypeField and Description
public static final String
Inherited from org.assertj.core.api.AbstractTemporalAssert:
comparables

Constructor Summary

AccessConstructor and Description
protected
AbstractOffsetDateTimeAssert(OffsetDateTime
the actual value to verify
actual
,
Class<?>
the "self type"
selfType
)

Creates a new org.assertj.core.api.AbstractOffsetDateTimeAssert.

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if both OffsetDateTime are in the same year, month, day of month and hour, false otherwise.
areEqualIgnoringMinutes
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year, month, day of month and hour, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false otherwise.
areEqualIgnoringNanos
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same year, month, day of month, hour and minute, false otherwise.
areEqualIgnoringSeconds
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year, month, day of month, hour and minute, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same hour, minute, second and nanosecond false otherwise.
areEqualIgnoringTimezone
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same hour, minute, second and nanosecond false otherwise.

private static void
assertOffsetDateTimeAsStringParameterIsNotNull(String
String representing the java.time.OffsetDateTime to compare actual with
offsetDateTimeAsString
)

Check that the java.time.OffsetDateTime string representation to compare actual java.time.OffsetDateTime to is not null, otherwise throws a IllegalArgumentException with an explicit message

private static void
assertOffsetDateTimeParameterIsNotNull(OffsetDateTime other)

Check that the java.time.OffsetDateTime to compare actual java.time.OffsetDateTime to is not null, in that case throws a IllegalArgumentException with an explicit message

private Comparables
private void
private static Object[]
convertToOffsetDateTimeArray(String... dateTimesAsString)

private static boolean

Returns:

true if both OffsetDateTime are in the same year, false otherwise
haveSameNano
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same nanosecond, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same year, false otherwise
haveSameYear
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same year and month, false otherwise
haveSameYearAndMonth
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year and month, false otherwise.

private static boolean

Returns:

true if both OffsetDateTime are in the same year, month and day of month, false otherwise
haveSameYearMonthAndDayOfMonth
(OffsetDateTime
the actual OffsetDateTime. expected not be null
actual
,
OffsetDateTime
the other OffsetDateTime. expected not be null
other
)

Returns true if both OffsetDateTime are in the same year, month and day of month, false otherwise.

public SELF

Returns:

this assertion object.
isAfter
(OffsetDateTime other)

Verifies that the actual OffsetDateTime is strictly after the given one according to the comparator in use.

public SELF

Returns:

this assertion object.
isAfter
(String
String representing a java.time.OffsetDateTime.
offsetDateTimeAsString
)

Same assertion as isAfter(java.time.OffsetDateTime) but the java.time.OffsetDateTime is built from given a String that must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isAfterOrEqualTo
(OffsetDateTime other)

Verifies that the actual OffsetDateTime is after or equals to the given one according to the comparator in use.

public SELF

Returns:

this assertion object.
isAfterOrEqualTo
(String
String representing a java.time.OffsetDateTime.
offsetDateTimeAsString
)

Same assertion as isAfterOrEqualTo(java.time.OffsetDateTime) but the java.time.OffsetDateTime is built from given String, which must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isAtSameInstantAs
(OffsetDateTime
the given OffsetDateTime.
other
)

Verifies that actual and given OffsetDateTime are at the same java.time.Instant.

public SELF

Returns:

this assertion object.
isBefore
(OffsetDateTime other)

Verifies that the actual OffsetDateTime is strictly before the given one according to the comparator in use.

public SELF

Returns:

this assertion object.
isBefore
(String
String representing a java.time.OffsetDateTime.
offsetDateTimeAsString
)

Same assertion as isBefore(java.time.OffsetDateTime) but the java.time.OffsetDateTime is built from given String, which must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isBeforeOrEqualTo
(OffsetDateTime other)

Verifies that the actual OffsetDateTime is before or equals to the given one according to the comparator in use.

public SELF

Returns:

this assertion object.
isBeforeOrEqualTo
(String
String representing a java.time.OffsetDateTime.
offsetDateTimeAsString
)

Same assertion as isBeforeOrEqualTo(java.time.OffsetDateTime) but the java.time.OffsetDateTime is built from given String, which must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isBetween
(OffsetDateTime
the start value (inclusive), expected not to be null.
startInclusive
,
OffsetDateTime
the end value (inclusive), expected not to be null.
endInclusive
)

Verifies that the actual OffsetDateTime is in the [start, end] period (start and end included) according to the comparator in use.

public SELF

Returns:

this assertion object.
isBetween
(String
the start value (inclusive), expected not to be null.
startInclusive
,
String
the end value (inclusive), expected not to be null.
endInclusive
)

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.

public SELF

Returns:

this assertion object
isCloseTo
(OffsetDateTime
the OffsetDateTime to compare actual to
other
,
TemporalOffset<? super OffsetDateTime>
the offset used for comparison
offset
)

Overrides org.assertj.core.api.AbstractTemporalAssert.isCloseTo.

Verifies that the actual OffsetDateTime is close to the other according to the given TemporalOffset.
public SELF

Returns:

this assertion object
isCloseToUtcNow
(TemporalUnitOffset
The offset used for comparison
offset
)

Verifies that the actual OffsetDateTime is close to the current date and time on the UTC timezone, according to the given TemporalUnitOffset.

public SELF

Returns:

this assertion object.
isEqualTo
(Object
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractAssert.isEqualTo.

Implements org.assertj.core.api.Assert.isEqualTo.

Verifies that the actual OffsetDateTime is equal to the given one according to the comparator in use.
public SELF

Returns:

this assertion object.
isEqualTo
(String
String representing a java.time.OffsetDateTime.
dateTimeAsString
)

Same assertion as isEqualTo(Object) (where Object is expected to be java.time.OffsetDateTime) but here you pass java.time.OffsetDateTime String representation that must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isEqualToIgnoringHours
(OffsetDateTime other)

Deprecated Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.
Verifies that actual and given OffsetDateTime have same year, month and day fields (hour, minute, second and nanosecond fields are ignored in comparison).
public SELF

Returns:

this assertion object.
isEqualToIgnoringMinutes
(OffsetDateTime other)

Deprecated Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.
Verifies that actual and given OffsetDateTime have same year, month, day and hour fields (minute, second and nanosecond fields are ignored in comparison).
public SELF

Returns:

this assertion object.
isEqualToIgnoringNanos
(OffsetDateTime other)

Deprecated Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.
Verifies that actual and given OffsetDateTime have same year, month, day, hour, minute and second fields, (nanosecond fields are ignored in comparison).
public SELF

Returns:

this assertion object.
isEqualToIgnoringSeconds
(OffsetDateTime other)

Deprecated Use isCloseTo(OffsetDateTime, TemporalOffset) instead, although not exactly the same semantics, this is the right way to compare with a given precision.
Verifies that actual and given java.time.OffsetDateTime have same year, month, day, hour and minute fields (second and nanosecond fields are ignored in comparison).
public SELF

Returns:

this assertion object.
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).

public SELF

Returns:

this assertion object.
isIn
(String...
String array representing java.time.OffsetDateTimes.
dateTimesAsString
)

Same assertion as isIn(Object...) (where Objects are expected to be java.time.OffsetDateTime) but here you pass java.time.OffsetDateTime String representations that must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isInTheFuture
()

Verifies that the actual OffsetDateTime is strictly in the future.

public SELF

Returns:

this assertion object.
isInThePast
()

Verifies that the actual OffsetDateTime is strictly in the past.

public SELF

Returns:

this assertion object.
isNotEqualTo
(Object
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractAssert.isNotEqualTo.

Implements org.assertj.core.api.Assert.isNotEqualTo.

Verifies that the actual OffsetDateTime is not equal to the given value according to the comparator in use.
public SELF

Returns:

this assertion object.
isNotEqualTo
(String
String representing a java.time.OffsetDateTime.
dateTimeAsString
)

Same assertion as isNotEqualTo(Object) (where Object is expected to be java.time.OffsetDateTime) but here you pass java.time.OffsetDateTime String representation that must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isNotIn
(String...
Array of String representing a java.time.OffsetDateTime.
dateTimesAsString
)

Same assertion as isNotIn(Object...) (where Objects are expected to be java.time.OffsetDateTime) but here you pass java.time.OffsetDateTime String representations that must follow ISO OffsetDateTime format to allow calling java.time.OffsetDateTime#parse(CharSequence) method.

public SELF

Returns:

this assertion object.
isStrictlyBetween
(OffsetDateTime
the start value (exclusive), expected not to be null.
startExclusive
,
OffsetDateTime
the end value (exclusive), expected not to be null.
endExclusive
)

Verifies that the actual OffsetDateTime is in the ]start, end[ period (start and end excluded) according to the comparator in use.

public SELF

Returns:

this assertion object.
isStrictlyBetween
(String
the start value (exclusive), expected not to be null.
startExclusive
,
String
the end value (exclusive), expected not to be null.
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
the string to parse, not null
offsetDateTimeAsString
)

Implements abstract org.assertj.core.api.AbstractTemporalAssert.parse.

Obtains an instance of TEMPORAL from a string representation in ISO date format.
public SELF
usingDefaultComparator()

Overrides org.assertj.core.api.AbstractTemporalAssert.usingDefaultComparator.

Implements org.assertj.core.api.Assert.usingDefaultComparator.

Revert to standard comparison for the incoming assertion checks.
Inherited from org.assertj.core.api.AbstractTemporalAssert:
getActualisCloseTousingComparatorusingComparator