Package org.assertj.core.data
Class TemporalUnitOffset
java.lang.Object
org.assertj.core.data.TemporalUnitOffset
- All Implemented Interfaces:
TemporalOffset<Temporal>
- Direct Known Subclasses:
TemporalUnitLessThanOffset,TemporalUnitWithinOffset
Base class for
TemporalOffset on basis of TemporalUnit.- Since:
- 3.7.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTemporalUnitOffset(long value, TemporalUnit unit) Creates a new temporal offset for a given temporal unit. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected DurationgetAbsoluteDuration(Temporal temporal1, Temporal temporal2) Returns absolute value of the difference as Duration.getBeyondOffsetDifferenceDescription(Temporal temporal1, Temporal temporal2) Returns description of the difference between temporal values and expected offset details.protected longgetDifference(Temporal temporal1, Temporal temporal2) Returns absolute value of the difference according to time unit.getUnit()inthashCode()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.data.TemporalOffset
isBeyondOffset
-
Field Details
-
unit
-
value
protected final long value
-
-
Constructor Details
-
TemporalUnitOffset
Creates a new temporal offset for a given temporal unit.- Parameters:
value- the value of the offset.unit- temporal unit of the offset.- Throws:
NullPointerException- if the given unit isnull.IllegalArgumentException- if the given value is negative.
-
-
Method Details
-
getBeyondOffsetDifferenceDescription
Returns description of the difference between temporal values and expected offset details. Is designed for the case when difference is beyond offset.- Specified by:
getBeyondOffsetDifferenceDescriptionin interfaceTemporalOffset<Temporal>- Parameters:
temporal1- first temporal value which is being validated against second temporal value.temporal2- second temporal value.- Returns:
- difference description.
-
getDifference
Returns absolute value of the difference according to time unit. -
getAbsoluteDuration
Returns absolute value of the difference as Duration. -
getUnit
-
hashCode
public int hashCode() -
equals
-