Class AbstractLocalTimeAssert<SELF extends AbstractLocalTimeAssert<SELF>>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,TEMPORAL>
-
- org.assertj.core.api.AbstractTemporalAssert<SELF,LocalTime>
-
- org.assertj.core.api.AbstractLocalTimeAssert<SELF>
-
- All Implemented Interfaces:
Assert<SELF,LocalTime>
,Descriptable<SELF>
,ExtensionPoints<SELF,LocalTime>
- Direct Known Subclasses:
LocalTimeAssert
public abstract class AbstractLocalTimeAssert<SELF extends AbstractLocalTimeAssert<SELF>> extends AbstractTemporalAssert<SELF,LocalTime>
Assertions forLocalTime
type from new Date & Time API introduced in Java 8.
-
-
Field Summary
Fields Modifier and Type Field Description static String
NULL_LOCAL_TIME_PARAMETER_MESSAGE
-
Fields inherited from class org.assertj.core.api.AbstractTemporalAssert
comparables
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLocalTimeAssert(LocalTime actual, Class<?> selfType)
Creates a new
.AbstractLocalTimeAssert
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
areEqualIgnoringNanos(LocalTime actual, LocalTime other)
Returns true if both localtime are in the same year, month and day of month, hour, minute and second, false otherwise.private static boolean
areEqualIgnoringSeconds(LocalTime actual, LocalTime other)
Returns true if both localtime are in the same year, month, day of month, hour and minute, false otherwise.private static void
assertLocalTimeAsStringParameterIsNotNull(String localTimeAsString)
Check that theLocalTime
string representation to compare actualLocalTime
to is not null, otherwise throws aIllegalArgumentException
with an explicit messageprivate static void
assertLocalTimeParameterIsNotNull(LocalTime other)
Check that theLocalTime
to compare actualLocalTime
to is not null, in that case throws aIllegalArgumentException
with an explicit messageprivate void
checkIsNotNullAndNotEmpty(Object[] values)
private static Object[]
convertToLocalTimeArray(String... localTimesAsString)
SELF
hasSameHourAs(LocalTime other)
Verifies that actual and givenLocalTime
have same hour fields (minute, second and nanosecond fields are ignored in comparison).private static boolean
haveSameHourField(LocalTime actual, LocalTime other)
SELF
isAfter(String localTimeAsString)
Same assertion asisAfter(LocalTime)
but theLocalTime
is built from given a String that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isAfter(LocalTime other)
Verifies that the actualLocalTime
is strictly after the given one.SELF
isAfterOrEqualTo(String localTimeAsString)
Same assertion asisAfterOrEqualTo(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isAfterOrEqualTo(LocalTime other)
Verifies that the actualLocalTime
is after or equals to the given one.SELF
isBefore(String localTimeAsString)
Same assertion asisBefore(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isBefore(LocalTime other)
Verifies that the actualLocalTime
is strictly before the given one.SELF
isBeforeOrEqualTo(String localTimeAsString)
Same assertion asisBeforeOrEqualTo(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isBeforeOrEqualTo(LocalTime other)
Verifies that the actualLocalTime
is before or equals to the given one.SELF
isBetween(String startInclusive, String endInclusive)
Same assertion asisBetween(LocalTime, LocalTime)
but here you passLocalTime
String representations which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isBetween(LocalTime startInclusive, LocalTime endInclusive)
Verifies that the actualLocalTime
is in the [start, end] period (start and end included).SELF
isEqualTo(String localTimeAsString)
Same assertion asAbstractAssert.isEqualTo(Object)
(where Object is expected to beLocalTime
) but here you passLocalTime
String representation that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isEqualToIgnoringNanos(LocalTime other)
Verifies that actual and givenLocalTime
have same hour, minute and second fields (nanosecond fields are ignored in comparison).SELF
isEqualToIgnoringSeconds(LocalTime other)
Verifies that actual and givenLocalTime
have same hour and minute fields (second and nanosecond fields are ignored in comparison).SELF
isIn(String... localTimesAsString)
Same assertion asAbstractAssert.isIn(Object...)
(where Objects are expected to beLocalTime
) but here you passLocalTime
String representations that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isNotEqualTo(String localTimeAsString)
Same assertion asAbstractAssert.isNotEqualTo(Object)
(where Object is expected to beLocalTime
) but here you passLocalTime
String representation that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isNotIn(String... localTimesAsString)
Same assertion asAbstractAssert.isNotIn(Object...)
(where Objects are expected to beLocalTime
) but here you passLocalTime
String representations that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isStrictlyBetween(String startExclusive, String endExclusive)
Same assertion asisStrictlyBetween(LocalTime, LocalTime)
but here you passLocalTime
String representations which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.SELF
isStrictlyBetween(LocalTime startExclusive, LocalTime endExclusive)
Verifies that the actualLocalTime
is in the ]start, end[ period (start and end excluded).protected LocalTime
parse(String localTimeAsString)
Obtains an instance ofTEMPORAL
from a string representation in ISO date format.-
Methods inherited from class org.assertj.core.api.AbstractTemporalAssert
getActual, isCloseTo, isCloseTo
-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, 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, withAssertionState, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Field Detail
-
NULL_LOCAL_TIME_PARAMETER_MESSAGE
public static final String NULL_LOCAL_TIME_PARAMETER_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractLocalTimeAssert
protected AbstractLocalTimeAssert(LocalTime actual, Class<?> selfType)
Creates a new
.AbstractLocalTimeAssert
- Parameters:
selfType
- the "self type"actual
- the actual value to verify
-
-
Method Detail
-
isBefore
public SELF isBefore(LocalTime other)
Verifies that the actualLocalTime
is strictly before the given one.Example :
assertThat(parse("12:00:00")).isBefore(parse("13:00:00"));
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is not strictly before the given one.
-
isBefore
public SELF isBefore(String localTimeAsString)
Same assertion asisBefore(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("12:59")).isBefore("13:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not strictly before theLocalTime
built from given String.
-
isBeforeOrEqualTo
public SELF isBeforeOrEqualTo(LocalTime other)
Verifies that the actualLocalTime
is before or equals to the given one.Example :
assertThat(parse("12:00:00")).isBeforeOrEqualTo(parse("12:00:00")) .isBeforeOrEqualTo(parse("12:00:01"));
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is not before or equals to the given one.
-
isBeforeOrEqualTo
public SELF isBeforeOrEqualTo(String localTimeAsString)
Same assertion asisBeforeOrEqualTo(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("12:00:00")).isBeforeOrEqualTo("12:00:00") .isBeforeOrEqualTo("13:00:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not before or equals to theLocalTime
built from given String.
-
isAfterOrEqualTo
public SELF isAfterOrEqualTo(LocalTime other)
Verifies that the actualLocalTime
is after or equals to the given one.Example :
assertThat(parse("13:00:00")).isAfterOrEqualTo(parse("13:00:00")) .isAfterOrEqualTo(parse("12:00:00"));
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is not after or equals to the given one.
-
isAfterOrEqualTo
public SELF isAfterOrEqualTo(String localTimeAsString)
Same assertion asisAfterOrEqualTo(LocalTime)
but theLocalTime
is built from given String, which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isAfterOrEqualTo("13:00:00") .isAfterOrEqualTo("12:00:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not after or equals to theLocalTime
built from given String.
-
isAfter
public SELF isAfter(LocalTime other)
Verifies that the actualLocalTime
is strictly after the given one.Example :
assertThat(parse("13:00:00")).isAfter(parse("12:00:00"));
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is not strictly after the given one.
-
isAfter
public SELF isAfter(String localTimeAsString)
Same assertion asisAfter(LocalTime)
but theLocalTime
is built from given a String that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isAfter("12:00:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not strictly after theLocalTime
built from given String.
-
isEqualTo
public SELF isEqualTo(String localTimeAsString)
Same assertion asAbstractAssert.isEqualTo(Object)
(where Object is expected to beLocalTime
) but here you passLocalTime
String representation that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isEqualTo("13:00:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not equal to theLocalTime
built from given String.
-
isNotEqualTo
public SELF isNotEqualTo(String localTimeAsString)
Same assertion asAbstractAssert.isNotEqualTo(Object)
(where Object is expected to beLocalTime
) but here you passLocalTime
String representation that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTime as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isNotEqualTo("12:00:00");
- Parameters:
localTimeAsString
- String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is equal to theLocalTime
built from given String.
-
isIn
public SELF isIn(String... localTimesAsString)
Same assertion asAbstractAssert.isIn(Object...)
(where Objects are expected to beLocalTime
) but here you passLocalTime
String representations that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTimes as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isIn("12:00:00", "13:00:00");
- Parameters:
localTimesAsString
- String array representingLocalTime
s.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is not in theLocalTime
s built from given Strings.
-
isNotIn
public SELF isNotIn(String... localTimesAsString)
Same assertion asAbstractAssert.isNotIn(Object...)
(where Objects are expected to beLocalTime
) but here you passLocalTime
String representations that must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example :
// you can express expected LocalTimes as String (AssertJ taking care of the conversion) assertThat(parse("13:00:00")).isNotIn("12:00:00", "14:00:00");
- Parameters:
localTimesAsString
- Array of String representing aLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if given String is null or can't be converted to aLocalTime
.AssertionError
- if the actualLocalTime
is in theLocalTime
s built from given Strings.
-
convertToLocalTimeArray
private static Object[] convertToLocalTimeArray(String... localTimesAsString)
-
checkIsNotNullAndNotEmpty
private void checkIsNotNullAndNotEmpty(Object[] values)
-
assertLocalTimeAsStringParameterIsNotNull
private static void assertLocalTimeAsStringParameterIsNotNull(String localTimeAsString)
Check that theLocalTime
string representation to compare actualLocalTime
to is not null, otherwise throws aIllegalArgumentException
with an explicit message- Parameters:
localTimeAsString
- String representing theLocalTime
to compare actual with- Throws:
IllegalArgumentException
- with an explicit message if the givenString
is null
-
assertLocalTimeParameterIsNotNull
private static void assertLocalTimeParameterIsNotNull(LocalTime other)
Check that theLocalTime
to compare actualLocalTime
to is not null, in that case throws aIllegalArgumentException
with an explicit message- Parameters:
other
- theLocalTime
to check- Throws:
IllegalArgumentException
- with an explicit message if the givenLocalTime
is null
-
isEqualToIgnoringNanos
public SELF isEqualToIgnoringNanos(LocalTime other)
Verifies that actual and givenLocalTime
have same hour, minute and second fields (nanosecond fields are ignored in comparison).Assertion can fail with localTimes in same chronological nanosecond time window, e.g :
23:00:01.000000000 and 23:00:00.999999999.
Assertion fails as second fields differ even if time difference is only 1ns.
Code example :
// successful assertions LocalTime localTime1 = LocalTime.of(12, 0, 1, 0); LocalTime localTime2 = LocalTime.of(12, 0, 1, 456); assertThat(localTime1).isEqualToIgnoringNanos(localTime2); // failing assertions (even if time difference is only 1ns) LocalTime localTimeA = LocalTime.of(12, 0, 1, 0); LocalTime localTimeB = LocalTime.of(12, 0, 0, 999999999); assertThat(localTimeA).isEqualToIgnoringNanos(localTimeB);
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is are not equal with nanoseconds ignored.
-
isEqualToIgnoringSeconds
public SELF isEqualToIgnoringSeconds(LocalTime other)
Verifies that actual and givenLocalTime
have same hour and minute fields (second and nanosecond fields are ignored in comparison).Assertion can fail with LocalTimes in same chronological second time window, e.g :
23:01:00.000 and 23:00:59.000.
Assertion fails as minute fields differ even if time difference is only 1s.
Code example :
// successful assertions LocalTime localTime1 = LocalTime.of(23, 50, 0, 0); LocalTime localTime2 = LocalTime.of(23, 50, 10, 456); assertThat(localTime1).isEqualToIgnoringSeconds(localTime2); // failing assertions (even if time difference is only 1ms) LocalTime localTimeA = LocalTime.of(23, 50, 00, 000); LocalTime localTimeB = LocalTime.of(23, 49, 59, 999); assertThat(localTimeA).isEqualToIgnoringSeconds(localTimeB);
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is are not equal with second and nanosecond fields ignored.
-
hasSameHourAs
public SELF hasSameHourAs(LocalTime other)
Verifies that actual and givenLocalTime
have same hour fields (minute, second and nanosecond fields are ignored in comparison).Assertion can fail with localTimes in same chronological second time window, e.g :
01:00:00.000 and 00:59:59.000.
Time difference is only 1s but hour fields differ.
Code example :
// successful assertions LocalTime localTime1 = LocalTime.of(23, 50, 0, 0); LocalTime localTime2 = LocalTime.of(23, 00, 2, 7); assertThat(localTime1).hasSameHourAs(localTime2); // failing assertions (even if time difference is only 1ms) LocalTime localTimeA = LocalTime.of(01, 00, 00, 000); LocalTime localTimeB = LocalTime.of(00, 59, 59, 999); assertThat(localTimeA).hasSameHourAs(localTimeB);
- Parameters:
other
- the givenLocalTime
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualLocalTime
isnull
.IllegalArgumentException
- if otherLocalTime
isnull
.AssertionError
- if the actualLocalTime
is are not equal ignoring minute, second and nanosecond fields.
-
isBetween
public SELF isBetween(LocalTime startInclusive, LocalTime endInclusive)
Verifies that the actualLocalTime
is in the [start, end] period (start and end included).Example:
LocalTime localTime = LocalTime.now(); // assertions succeed: assertThat(localTime).isBetween(localTime.minusSeconds(1), localTime.plusSeconds(1)) .isBetween(localTime, localTime.plusSeconds(1)) .isBetween(localTime.minusSeconds(1), localTime) .isBetween(localTime, localTime); // assertions fail: assertThat(localTime).isBetween(localTime.minusSeconds(10), localTime.minusSeconds(1)); assertThat(localTime).isBetween(localTime.plusSeconds(1), localTime.plusSeconds(10));
- Parameters:
startInclusive
- the start value (inclusive), expected not to be null.endInclusive
- the end value (inclusive), expected not to be null.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actual value isnull
.NullPointerException
- if start value isnull
.NullPointerException
- if end value isnull
.AssertionError
- if the actual value is not in [start, end] period.- Since:
- 3.7.1
-
isBetween
public SELF isBetween(String startInclusive, String endInclusive)
Same assertion asisBetween(LocalTime, LocalTime)
but here you passLocalTime
String representations which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example:
LocalTime oneAm = LocalTime.parse("01:00:00"); // assertions succeed: assertThat(oneAm).isBetween("00:59:59", "01:00:01") .isBetween("01:00:00", "01:00:01") .isBetween("00:59:59", "01:00:00") .isBetween("01:00:00", "01:00:00"); // assertion fails: assertThat(oneAm).isBetween("00:59:00", "00:59:59");
- Parameters:
startInclusive
- the start value (inclusive), expected not to be null.endInclusive
- the end value (inclusive), expected not to be null.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actual value isnull
.NullPointerException
- if start value isnull
.NullPointerException
- if end value isnull
.DateTimeParseException
- if any of the given String can't be converted to aLocalTime
.AssertionError
- if the actual value is not in [start, end] period.- Since:
- 3.7.1
-
isStrictlyBetween
public SELF isStrictlyBetween(LocalTime startExclusive, LocalTime endExclusive)
Verifies that the actualLocalTime
is in the ]start, end[ period (start and end excluded).Example:
LocalTime localTime = LocalTime.now(); // assertion succeeds: assertThat(localTime).isStrictlyBetween(localTime.minusSeconds(1), localTime.plusSeconds(1)); // assertions fail: assertThat(localTime).isStrictlyBetween(localTime.minusSeconds(10), localTime.minusSeconds(1)); assertThat(localTime).isStrictlyBetween(localTime.plusSeconds(1), localTime.plusSeconds(10)); assertThat(localTime).isStrictlyBetween(localTime, localTime.plusSeconds(1)); assertThat(localTime).isStrictlyBetween(localTime.minusSeconds(1), localTime);
- Parameters:
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actual value isnull
.NullPointerException
- if start value isnull
.NullPointerException
- if end value isnull
.AssertionError
- if the actual value is not in ]start, end[ period.- Since:
- 3.7.1
-
isStrictlyBetween
public SELF isStrictlyBetween(String startExclusive, String endExclusive)
Same assertion asisStrictlyBetween(LocalTime, LocalTime)
but here you passLocalTime
String representations which must follow ISO LocalTime format to allow callingLocalTime.parse(CharSequence)
method.Example:
LocalTime oneAm = LocalTime.parse("01:00:00"); // assertion succeeds: assertThat(oneAm).isStrictlyBetween("00:59:59", "01:00:01"); // assertion fails: assertThat(oneAm).isStrictlyBetween("00:59:00", "00:59:59"); assertThat(oneAm).isStrictlyBetween("01:00:00", "01:00:01"); assertThat(oneAm).isStrictlyBetween("00:59:59", "01:00:00");
- Parameters:
startExclusive
- the start value (exclusive), expected not to be null.endExclusive
- the end value (exclusive), expected not to be null.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actual value isnull
.NullPointerException
- if start value isnull
.NullPointerException
- if end value isnull
.DateTimeParseException
- if any of the given String can't be converted to aLocalTime
.AssertionError
- if the actual value is not in ]start, end[ period.- Since:
- 3.7.1
-
parse
protected LocalTime parse(String localTimeAsString)
Obtains an instance ofTEMPORAL
from a string representation in ISO date format.- Specified by:
parse
in classAbstractTemporalAssert<SELF extends AbstractLocalTimeAssert<SELF>,LocalTime>
- Parameters:
localTimeAsString
- the string to parse, not null- Returns:
- the parsed
TEMPORAL
, not null
-
areEqualIgnoringNanos
private static boolean areEqualIgnoringNanos(LocalTime actual, LocalTime other)
Returns true if both localtime are in the same year, month and day of month, hour, minute and second, false otherwise.- Parameters:
actual
- the actual localtime. expected not be nullother
- the other localtime. expected not be null- Returns:
- true if both localtime are in the same year, month and day of month, hour, minute and second, false otherwise.
-
areEqualIgnoringSeconds
private static boolean areEqualIgnoringSeconds(LocalTime actual, LocalTime other)
Returns true if both localtime are in the same year, month, day of month, hour and minute, false otherwise.- Parameters:
actual
- the actual localtime. expected not be nullother
- the other localtime. expected not be null- Returns:
- true if both localtime are in the same year, month, day of month, hour and minute, false otherwise.
-
-