public abstract class AbstractPeriodAssert<SELF extends AbstractPeriodAssert<SELF>> extends AbstractAssert<SELF,Period>
Period type.actual, info, myself, objects, throwUnsupportedExceptionOnEquals| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPeriodAssert(Period period,
Class<?> selfType)
Creates a new
|
| Modifier and Type | Method and Description |
|---|---|
SELF |
hasDays(int expectedDays)
Verifies that the actual
Period has the given days. |
SELF |
hasMonths(int expectedMonths)
Verifies that the actual
Period has the given months. |
SELF |
hasYears(int expectedYears)
Verifies that the actual
Period has the given years. |
SELF |
isNegative()
Verifies that the actual
Period is negative (i.e. |
SELF |
isPositive()
Verifies that the actual
Period is positive (i.e. |
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitas, as, as, describedAsprotected AbstractPeriodAssert(Period period, Class<?> selfType)
AbstractPeriodAssertperiod - the actual value to verifyselfType - the "self type"public SELF hasYears(int expectedYears)
Period has the given years.
Example :
// assertion will pass
assertThat(Period.ofYears(5)).hasYears(5);
// assertion will fail
assertThat(Period.ofYears(5)).hasYears(1);expectedYears - the expected years valueAssertionError - if the actual Period is nullAssertionError - if the actual Period does not have the given yearspublic SELF hasMonths(int expectedMonths)
Period has the given months.
Example :
// assertion will pass
assertThat(Period.ofMonths(5)).hasMonths(5);
// assertion will fail
assertThat(Period.ofMonths(5)).hasMonths(1);expectedMonths - the expected months valueAssertionError - if the actual Period is nullAssertionError - if the actual Period does not have the given monthspublic SELF hasDays(int expectedDays)
Period has the given days.
Example :
// assertion will pass
assertThat(Period.ofDays(5)).hasDays(5);
// assertion will fail
assertThat(Period.ofDays(5)).hasDays(1);expectedDays - the expected days valueAssertionError - if the actual Period is nullAssertionError - if the actual Period does not have the given dayspublic SELF isPositive()
Period is positive (i.e. is greater than Period.ZERO).
Example :
// assertion will pass
assertThat(Period.ofMonths(5)).isPositive();
// assertion will fail
assertThat(Period.ofMonths(-2)).isPositive();AssertionError - if the actual Period is nullAssertionError - if the actual Period is not greater than Period.ZEROpublic SELF isNegative()
Period is negative (i.e. is less than Period.ZERO).
Example :
// assertion will pass
assertThat(Period.ofMonths(-5)).isNegative();
// assertion will fail
assertThat(Period.ofMonths(2)).isNegative();AssertionError - if the actual Period is nullAssertionError - if the actual Period is not greater than Period.ZEROCopyright © 2025. All rights reserved.