Class AbstractLongAdderAssert<SELF extends AbstractLongAdderAssert<SELF>>
- Type Parameters:
SELF- the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
- All Implemented Interfaces:
Assert<SELF,,LongAdder> ComparableAssert<SELF,,Long> Descriptable<SELF>,ExtensionPoints<SELF,,LongAdder> NumberAssert<SELF,Long>
- Direct Known Subclasses:
LongAdderAssert
LongAdders.- Since:
- 3.16.0
- Author:
- Grzegorz Piwowarek
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractLongAdderAssert(LongAdder longAdder, Class<?> selfType) -
Method Summary
Modifier and TypeMethodDescriptiondoesNotHaveValue(long unexpected) Verifies that the actual sum has not the given value.hasValue(long expected) Verifies that the actual sum has the given value.Verifies that the actual value is in [start, end] range (start included, end included).Verifies that the actual number is close to the given one within the given offset.
If difference is equal to offset value, assertion is considered valid.isCloseTo(Long expected, Percentage percentage) Verifies that the actual number is close to the given one within the given percentage.
If difference is equal to the percentage value, assertion is considered valid.isEqualByComparingTo(Long other) Verifies that the actual value is equal to the given one by invoking.Comparable.compareTo(Object)isGreaterThan(Long other) Verifies that the actual value is greater than the given one.isGreaterThanOrEqualTo(Long other) Verifies that the actual value is greater than or equal to the given one.isLessThan(Long other) Verifies that the actual value is less than the given one.isLessThanOrEqualTo(Long other) Verifies that the actual value is less than or equal to the given one.Verifies that the actual value is negative.isNotCloseTo(Long expected, Offset<Long> offset) Verifies that the actual number is not close to the given one within the given offset.
If the difference is equal to the offset value, the assertion fails.isNotCloseTo(Long expected, Percentage percentage) Verifies that the actual number is not close to the given one within the given percentage.
If difference is equal to the percentage value, the assertion fails.isNotEqualByComparingTo(Long other) Verifies that the actual value is not equal to the given one by invoking.Comparable.compareTo(Object)Verifies that the actual value is non negative (positive or equal zero).Verifies that the actual value is non positive (negative or equal zero).Verifies that the actual value is not equal to zero.isOne()Verifies that the actual value is equal to one.Verifies that the actual value is positive.isStrictlyBetween(Long start, Long end) Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).isZero()Verifies that the actual value is equal to zero.usingComparator(Comparator<? super LongAdder> customComparator) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.usingComparator(Comparator<? super LongAdder> customComparator, String customComparatorDescription) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.Revert to standard comparison for the incoming assertion checks.Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, 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, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
AbstractLongAdderAssert
-
-
Method Details
-
hasValue
Verifies that the actual sum has the given value.Example:
// assertion will pass LongAdder actual = new LongAdder(); actual.add(42); assertThat(actual).hasValue(42); // assertion will fail assertThat(actual).hasValue(0);- Parameters:
expected- the expected value.- Returns:
thisassertion object.- Throws:
AssertionError- if the actual adder isnull.
-
doesNotHaveValue
Verifies that the actual sum has not the given value.Example:
// assertion will pass LongAdder actual = new LongAdder(); actual.add(42); assertThat(actual).doesNotHaveValue(0); // assertion will fail assertThat(actual).doesNotHaveValue(42);- Parameters:
unexpected- the unexpected value.- Returns:
thisassertion object.- Throws:
AssertionError- if the actual adder isnull.AssertionError- if the actual sum is not the given value.
-
usingComparator
Description copied from class:AbstractAssertUse the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :). // raceComparator implements Comparator<Character> assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);- Specified by:
usingComparatorin interfaceAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Overrides:
usingComparatorin classAbstractAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Parameters:
customComparator- the comparator to use for the incoming assertion checks.- Returns:
thisassertion object.
-
usingComparator
public SELF usingComparator(Comparator<? super LongAdder> customComparator, String customComparatorDescription) Description copied from class:AbstractAssertUse the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.The custom comparator is bound to the current assertion chain, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :). // raceComparator implements Comparator<Character> assertThat(frodo).usingComparator(raceComparator, "Hobbit Race Comparator").isEqualTo(sam);- Specified by:
usingComparatorin interfaceAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Overrides:
usingComparatorin classAbstractAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Parameters:
customComparator- the comparator to use for the incoming assertion checks.customComparatorDescription- comparator description to be used in assertion error messages- Returns:
thisassertion object.
-
usingDefaultComparator
Description copied from class:AbstractAssertRevert to standard comparison for the incoming assertion checks.This method should be used to disable a custom comparison strategy set by calling
usingComparator.- Specified by:
usingDefaultComparatorin interfaceAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Overrides:
usingDefaultComparatorin classAbstractAssert<SELF extends AbstractLongAdderAssert<SELF>,LongAdder> - Returns:
thisassertion object.
-
isZero
Description copied from interface:NumberAssertVerifies that the actual value is equal to zero.Example:
// assertions will pass assertThat(0).isZero(); assertThat(0.0).isZero(); // assertions will fail assertThat(42).isZero(); assertThat(3.142).isZero();- Specified by:
isZeroin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
- this assertion object.
-
isNotZero
Description copied from interface:NumberAssertVerifies that the actual value is not equal to zero.Example:
// assertions will pass assertThat(42).isNotZero(); assertThat(3.142).isNotZero(); // assertions will fail assertThat(0).isNotZero(); assertThat(0.0).isNotZero();- Specified by:
isNotZeroin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
- this assertion object.
-
isOne
Description copied from interface:NumberAssertVerifies that the actual value is equal to one.Example:
// assertions will pass assertThat(1).isOne(); assertThat(1.0).isOne(); // assertions will fail assertThat(42).isOne(); assertThat(3.142).isOne();- Specified by:
isOnein interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
- this assertion object.
-
isPositive
Description copied from interface:NumberAssertVerifies that the actual value is positive.Example:
// assertions will pass assertThat(42).isPositive(); assertThat(3.142).isPositive(); // assertions will fail assertThat(0).isPositive(); assertThat(-42).isPositive();- Specified by:
isPositivein interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
- this assertion object.
-
isNegative
Description copied from interface:NumberAssertVerifies that the actual value is negative.Example:
// assertions will pass assertThat(-42).isNegative(); assertThat(-3.124).isNegative(); // assertions will fail assertThat(0).isNegative(); assertThat(42).isNegative();- Specified by:
isNegativein interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
- this assertion object.
-
isNotNegative
Description copied from interface:NumberAssertVerifies that the actual value is non negative (positive or equal zero).Example:
// assertions will pass assertThat(42).isNotNegative(); assertThat(0).isNotNegative(); // assertions will fail assertThat(-42).isNotNegative(); assertThat(-3.124).isNotNegative();- Specified by:
isNotNegativein interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
thisassertion object.
-
isNotPositive
Description copied from interface:NumberAssertVerifies that the actual value is non positive (negative or equal zero).Example:
// assertions will pass assertThat(-42).isNotPositive(); assertThat(0).isNotPositive(); // assertions will fail assertThat(42).isNotPositive(); assertThat(3.124).isNotPositive();- Specified by:
isNotPositivein interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Returns:
thisassertion object.
-
isEqualByComparingTo
Description copied from interface:ComparableAssertVerifies that the actual value is equal to the given one by invoking.Comparable.compareTo(Object)Example:
// assertion will pass assertThat(1.0).isEqualByComparingTo(1.0); // assertion will pass because 8.0 is equal to 8.00 usingBigDecimal.compareTo(BigDecimal)assertThat(new BigDecimal("8.0")).isEqualByComparingTo(new BigDecimal("8.00")); // assertion will fail assertThat(new BigDecimal(1.0)).isEqualByComparingTo(new BigDecimal(2.0));- Specified by:
isEqualByComparingToin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isNotEqualByComparingTo
Description copied from interface:ComparableAssertVerifies that the actual value is not equal to the given one by invoking.Comparable.compareTo(Object)Example:
// assertion will pass assertThat(new BigDecimal(1.0)).isNotEqualByComparingTo(new BigDecimal(2.0)); // assertion will fail assertThat(1.0).isNotEqualByComparingTo(1.0); // assertion will fail because 8.0 is equal to 8.00 usingBigDecimal.compareTo(BigDecimal)assertThat(new BigDecimal("8.0")).isNotEqualByComparingTo(new BigDecimal("8.00"));- Specified by:
isNotEqualByComparingToin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isLessThan
Description copied from interface:ComparableAssertVerifies that the actual value is less than the given one.Example:
// assertions will pass assertThat('a').isLessThan('b'); assertThat(BigInteger.ZERO).isLessThan(BigInteger.ONE); // assertions will fail assertThat('a').isLessThan('a'); assertThat(BigInteger.ONE).isLessThan(BigInteger.ZERO);- Specified by:
isLessThanin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isLessThanOrEqualTo
Description copied from interface:ComparableAssertVerifies that the actual value is less than or equal to the given one.Example:
// assertions will pass assertThat('a').isLessThanOrEqualTo('b'); assertThat('a').isLessThanOrEqualTo('a'); assertThat(BigInteger.ZERO).isLessThanOrEqualTo(BigInteger.ZERO); // assertions will fail assertThat('b').isLessThanOrEqualTo('a'); assertThat(BigInteger.ONE).isLessThanOrEqualTo(BigInteger.ZERO);- Specified by:
isLessThanOrEqualToin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isGreaterThan
Description copied from interface:ComparableAssertVerifies that the actual value is greater than the given one.Example:
// assertions will pass assertThat('b').isGreaterThan('a'); assertThat(BigInteger.ONE).isGreaterThan(BigInteger.ZERO); // assertions will fail assertThat('b').isGreaterThan('a'); assertThat(BigInteger.ZERO).isGreaterThan(BigInteger.ZERO);- Specified by:
isGreaterThanin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isGreaterThanOrEqualTo
Description copied from interface:ComparableAssertVerifies that the actual value is greater than or equal to the given one.Example:
// assertions will pass assertThat('b').isGreaterThanOrEqualTo('a'); assertThat(BigInteger.ONE).isGreaterThanOrEqualTo(BigInteger.ONE); // assertions will fail assertThat('a').isGreaterThanOrEqualTo('b'); assertThat(BigInteger.ZERO).isGreaterThanOrEqualTo(BigInteger.ONE);- Specified by:
isGreaterThanOrEqualToin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
other- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isBetween
Description copied from interface:NumberAssertVerifies that the actual value is in [start, end] range (start included, end included).Example:
// these assertions succeed ... assertThat(12).isBetween(10, 14); assertThat(12).isBetween(12, 14); assertThat(12).isBetween(10, 12); // ... but this one fails assertThat(12).isBetween(14, 16);- Specified by:
isBetweenin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Specified by:
isBetweenin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
start- the start value (inclusive), expected not to be null.end- the end value (inclusive), expected not to be null.- Returns:
- this assertion object.
-
isStrictlyBetween
Description copied from interface:NumberAssertVerifies that the actual value is in ]start, end[ range (start excluded, end excluded).Example:
// this assertion succeeds ... assertThat(12).isStrictlyBetween(10, 14); // ... but these ones fail assertThat(12).isStrictlyBetween(12, 14); assertThat(12).isStrictlyBetween(10, 12); assertThat(12).isStrictlyBetween(16, 18);- Specified by:
isStrictlyBetweenin interfaceComparableAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Specified by:
isStrictlyBetweenin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
start- the start value (exclusive), expected not to be null.end- the end value (exclusive), expected not to be null.- Returns:
- this assertion object.
-
isCloseTo
Description copied from interface:NumberAssertVerifies that the actual number is close to the given one within the given offset.
If difference is equal to offset value, assertion is considered valid.Example with double:
// assertions will pass: assertThat(8.1).isCloseTo(8.0, within(0.2)); // you can use offset if you prefer assertThat(8.1).isCloseTo(8.0, offset(0.2)); // if difference is exactly equals to the offset (0.1), it's ok assertThat(8.1).isCloseTo(8.0, within(0.1)); // assertion will fail assertThat(8.1).isCloseTo(8.0, within(0.01));- Specified by:
isCloseToin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
expected- the given number to compare the actual value to.offset- the given positive offset.- Returns:
thisassertion object.
-
isNotCloseTo
Description copied from interface:NumberAssertVerifies that the actual number is not close to the given one within the given offset.
If the difference is equal to the offset value, the assertion fails.Example with double:
// assertions will pass: assertThat(8.1).isNotCloseTo(8.0, byLessThan(0.01)); // you can use offset if you prefer assertThat(8.1).isNotCloseTo(8.0, offset(0.01)); // assertions will fail assertThat(8.1).isNotCloseTo(8.0, byLessThan(0.1)); assertThat(8.1).isNotCloseTo(8.0, byLessThan(0.2));- Specified by:
isNotCloseToin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
expected- the given number to compare the actual value to.offset- the given positive offset.- Returns:
thisassertion object.
-
isCloseTo
Description copied from interface:NumberAssertVerifies that the actual number is close to the given one within the given percentage.
If difference is equal to the percentage value, assertion is considered valid.Example with double:
// assertions will pass: assertThat(11.0).isCloseTo(10.0, withinPercentage(20)); // if difference is exactly equals to the computed offset (1.0), it's ok assertThat(11.0).isCloseTo(10.0, withinPercentage(10)); // assertion will fail assertThat(11.0).isCloseTo(10.0, withinPercentage(5));- Specified by:
isCloseToin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
expected- the given number to compare the actual value to.percentage- the given positive percentage.- Returns:
thisassertion object.
-
isNotCloseTo
Description copied from interface:NumberAssertVerifies that the actual number is not close to the given one within the given percentage.
If difference is equal to the percentage value, the assertion fails.Example with double:
// assertions will pass: assertThat(11.0).isNotCloseTo(10.0, withinPercentage(5)); // assertions will fail assertThat(11.0).isNotCloseTo(10.0, withinPercentage(10)); assertThat(11.0).isNotCloseTo(10.0, withinPercentage(20));- Specified by:
isNotCloseToin interfaceNumberAssert<SELF extends AbstractLongAdderAssert<SELF>,Long> - Parameters:
expected- the given number to compare the actual value to.percentage- the given positive percentage.- Returns:
thisassertion object.
-