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

public Class AbstractBigIntegerAssert<SELF extends AbstractBigIntegerAssert<SELF>>

extends AbstractComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>, BigInteger>
implements NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>, BigInteger>
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.NumberAssert
Known Direct Subclasses
org.assertj.core.api.BigIntegerAssert
Imports
java.math.BigInteger, java.util.Comparator, org.assertj.core.data.Offset, .Percentage, org.assertj.core.internal.BigIntegers, .ComparatorBasedComparisonStrategy, org.assertj.core.util.CheckReturnValue, .VisibleForTesting

Base class for all implementations of assertions for BigIntegers.
Since
2.7.0 / 3.7.0

Field Summary

Modifier and TypeField and Description
pack-priv BigIntegers
Inherited from org.assertj.core.api.AbstractComparableAssert:
comparables

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

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

Overrides org.assertj.core.api.AbstractComparableAssert.isBetween.

Implements org.assertj.core.api.NumberAssert.isBetween, org.assertj.core.api.ComparableAssert.isBetween.

Verifies that the actual value is in [start, end] range (start and end included).
public SELF

Returns:

this assertion object.
isCloseTo
(BigInteger
the given number to compare the actual value to.
expected
,
Offset<BigInteger>
the given positive offset.
offset
)

Implements org.assertj.core.api.NumberAssert.isCloseTo.

Verifies that the actual number is close to the given one within the given offset.
public SELF

Returns:

this assertion object.
isCloseTo
(BigInteger
the given number to compare the actual value to.
expected
,
Percentage
the given positive percentage.
percentage
)

Implements org.assertj.core.api.NumberAssert.isCloseTo.

Verifies that the actual number is close to the given one within the given percentage.
public SELF

Returns:

this assertion object.
isEqualTo
(String
the given number to compare the actual value to.
expected
)

Same as isEqualTo(BigInteger) but takes care of converting given String to BigInteger for you.

public SELF

Returns:

this assertion object.
isEqualTo
(int
the expected value
expected
)

Same as isEqualTo(BigInteger) but takes care of converting given int to BigInteger for you.

public SELF

Returns:

this assertion object.
isEqualTo
(long
the expected value
expected
)

Same as isEqualTo(BigInteger) but takes care of converting given int to BigInteger for you.

public SELF

Returns:

this assertion object.
isNegative
()

Implements org.assertj.core.api.NumberAssert.isNegative.

Verifies that the actual value is negative.
public SELF

Returns:

this assertion object.
isNotCloseTo
(BigInteger
the given number to compare the actual value to.
expected
,
Offset<BigInteger>
the given positive offset.
offset
)

Implements org.assertj.core.api.NumberAssert.isNotCloseTo.

Verifies that the actual number is not close to the given one by less than the given offset.
public SELF

Returns:

this assertion object.
isNotCloseTo
(BigInteger
the given number to compare the actual value to.
expected
,
Percentage
the given positive percentage.
percentage
)

Implements org.assertj.core.api.NumberAssert.isNotCloseTo.

Verifies that the actual number is not close to the given one by the given percentage.
public SELF

Returns:

this assertion object.
isNotNegative
()

Implements org.assertj.core.api.NumberAssert.isNotNegative.

Verifies that the actual value is non negative (positive or equal zero).
public SELF

Returns:

this assertion object.
isNotPositive
()

Implements org.assertj.core.api.NumberAssert.isNotPositive.

Verifies that the actual value is non positive (negative or equal zero).
public SELF

Returns:

this assertion object.
isNotZero
()

Implements org.assertj.core.api.NumberAssert.isNotZero.

Verifies that the actual value is not equal to zero.
public SELF

Returns:

this assertion object.
isOne
()

Implements org.assertj.core.api.NumberAssert.isOne.

Verifies that the actual value is equal to one.
public SELF

Returns:

this assertion object.
isPositive
()

Implements org.assertj.core.api.NumberAssert.isPositive.

Verifies that the actual value is positive.
public SELF

Returns:

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

Overrides org.assertj.core.api.AbstractComparableAssert.isStrictlyBetween.

Implements org.assertj.core.api.NumberAssert.isStrictlyBetween, org.assertj.core.api.ComparableAssert.isStrictlyBetween.

Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).
public SELF

Returns:

this assertion object.
isZero
()

Implements org.assertj.core.api.NumberAssert.isZero.

Verifies that the actual value is equal to zero.
public SELF
usingComparator(Comparator<? super BigInteger>
the comparator to use for the incoming assertion checks.
customComparator
)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
usingComparator(Comparator<? super BigInteger>
the comparator to use for the incoming assertion checks.
customComparator
,
String
comparator description to be used in assertion error messages
customComparatorDescription
)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
Inherited from org.assertj.core.api.AbstractComparableAssert:
inBinaryinHexadecimalisEqualByComparingToisGreaterThanisGreaterThanOrEqualToisLessThanisLessThanOrEqualToisNotEqualByComparingTo

Field Detail

bigIntegersback to summary
pack-priv BigIntegers bigIntegers
Annotations
@VisibleForTesting

Constructor Detail

AbstractBigIntegerAssertback to summary
protected AbstractBigIntegerAssert(BigInteger actual, Class<?> selfType)

Method Detail

isBetweenback to summary
public SELF isBetween(BigInteger start, BigInteger end)

Overrides org.assertj.core.api.AbstractComparableAssert.isBetween.

Implements org.assertj.core.api.NumberAssert.isBetween, org.assertj.core.api.ComparableAssert.isBetween.

Verifies that the actual value is in [start, end] range (start and end included).

Example:

 // assertions will pass
assertThat(new BigInteger("8")).isBetween(new BigInteger("7"), new BigInteger("9"));
assertThat(new BigInteger("8")).isBetween(new BigInteger("8"), new BigInteger("9"));
assertThat(new BigInteger("8")).isBetween(new BigInteger("7"), new BigInteger("8"));

// assertion will fail
assertThat(new BigInteger("8")).isBetween(new BigInteger("6"), new BigInteger("7"));
Parameters
start:BigInteger

Doc from org.assertj.core.api.NumberAssert.isBetween.

the start value (inclusive), expected not to be null.

end:BigInteger

Doc from org.assertj.core.api.NumberAssert.isBetween.

the end value (inclusive), expected not to be null.

Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isCloseToback to summary
public SELF isCloseTo(BigInteger expected, Offset<BigInteger> offset)

Implements org.assertj.core.api.NumberAssert.isCloseTo.

Verifies that the actual number is close to the given one within the given offset.

When abs(actual - expected) == offset value, the assertion:

Breaking change since 2.9.0/3.9.0: using Assertions#byLessThan(BigInteger) implies a strict comparison, use Assertions#within(BigInteger) to get the old behavior.

Example:

 import static org.assertj.core.api.Assertions.within;

final BigInteger eight = new BigInteger("8");
final BigInteger ten =  BigInteger.TEN;

// valid assertion
assertThat(eight).isCloseTo(ten, within(new BigInteger("3")));
assertThat(eight).isCloseTo(ten, byLessThan(new BigInteger("3")));

// if difference is exactly equals to given offset value, it's ok
assertThat(eight).isCloseTo(ten, within(new BigInteger("2")));
// ... but not with byLessThan which implies a strict comparison
assertThat(eight).isCloseTo(ten, byLessThan(new BigInteger("2")));

// assertions will fail:
assertThat(eight).isCloseTo(ten, within(BigInteger.ONE));
assertThat(eight).isCloseTo(ten, byLessThan(BigInteger.ONE));
Parameters
expected:BigInteger

the given number to compare the actual value to.

offset:Offset<BigInteger>

the given positive offset.

Returns:SELF

this assertion object.

Annotations
@Override
Exceptions
NullPointerException:
  • if the given offset is null.
  • if the expected number is null.
AssertionError:
if the actual value is not close to the given one.
Since
2.7.0 / 3.7.0
isCloseToback to summary
public SELF isCloseTo(BigInteger expected, Percentage percentage)

Implements org.assertj.core.api.NumberAssert.isCloseTo.

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.

Example with BigInteger:

 import static org.assertj.core.api.Assertions.withinPercentage;

// assertions will pass:
assertThat(new BigInteger("11")).isCloseTo(BigInteger.TEN, withinPercentage(20));

// if difference is exactly equals to the computed offset (1), it's ok
assertThat(new BigInteger("11")).isCloseTo(BigInteger.TEN, withinPercentage(10));

// assertion will fail
assertThat(new BigInteger("11")).isCloseTo(BigInteger.TEN, withinPercentage(5));
Parameters
expected:BigInteger

the given number to compare the actual value to.

percentage:Percentage

the given positive percentage.

Returns:SELF

this assertion object.

Annotations
@Override
Exceptions
NullPointerException:
  • if the given offset is null.
  • if the expected number is null.
AssertionError:
if the actual value is not close to the given one.
Since
2.7.0 / 3.7.0
isEqualToback to summary
public SELF isEqualTo(String expected)

Same as isEqualTo(BigInteger) but takes care of converting given String to BigInteger for you.

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isEqualTo("8");

// assertion will fail
assertThat(new BigInteger("8")).isEqualTo("2");
Parameters
expected:String

the given number to compare the actual value to.

Returns:SELF

this assertion object.

Since
2.7.0 / 3.7.0
isEqualToback to summary
public SELF isEqualTo(int expected)

Same as isEqualTo(BigInteger) but takes care of converting given int to BigInteger for you.

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isEqualTo(8);

// assertion will fail
assertThat(new BigInteger("8")).isEqualTo(2);
Parameters
expected:int

the expected value

Returns:SELF

this assertion object.

Since
2.7.0 / 3.7.0
isEqualToback to summary
public SELF isEqualTo(long expected)

Same as isEqualTo(BigInteger) but takes care of converting given int to BigInteger for you.

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isEqualTo(8L);

// assertion will fail
assertThat(new BigInteger("8")).isEqualTo(2L);
Parameters
expected:long

the expected value

Returns:SELF

this assertion object.

Since
2.7.0 / 3.7.0
isNegativeback to summary
public SELF isNegative()

Implements org.assertj.core.api.NumberAssert.isNegative.

Verifies that the actual value is negative.

Example:

 // assertion will pass
assertThat(new BigInteger("-8")).isNegative();

// assertion will fail
assertThat(new BigInteger("8")).isNegative();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isNotCloseToback to summary
public SELF isNotCloseTo(BigInteger expected, Offset<BigInteger> offset)

Implements org.assertj.core.api.NumberAssert.isNotCloseTo.

Verifies that the actual number is not close to the given one by less than the given offset.

When abs(actual - expected) == offset value, the assertion:

Breaking change since 2.9.0/3.9.0: using Assertions#byLessThan(BigInteger) implies a strict comparison, use Assertions#within(BigInteger) to get the old behavior.

Examples:

 import static org.assertj.core.api.Assertions.byLessThan;

final BigInteger eight = new BigInteger("8");
final BigInteger ten =  BigInteger.TEN;

// this assertion succeeds
assertThat(eight).isNotCloseTo(ten, byLessThan(BigInteger.ONE));
assertThat(eight).isNotCloseTo(ten, within(BigInteger.ONE));

// diff == offset but isNotCloseTo succeeds as we use byLessThan
assertThat(eight).isNotCloseTo(ten, byLessThan(new BigInteger("2")));

// the assertion fails as the difference is equal to the offset value and we use 'within'
assertThat(eight).isNotCloseTo(ten, within(new BigInteger("2")));
// the assertion fails if the difference is greater than the given offset value
assertThat(eight).isNotCloseTo(ten, within(new BigInteger("3")));
assertThat(eight).isNotCloseTo(ten, byLessThan(new BigInteger("3")));
Parameters
expected:BigInteger

the given number to compare the actual value to.

offset:Offset<BigInteger>

the given positive offset.

Returns:SELF

this assertion object.

Annotations
@Override
Exceptions
NullPointerException:
  • if the given offset is null.
  • if the expected number is null.
AssertionError:
if the actual value is close to the given one within the offset value.
Since
2.7.0 / 3.7.0
See Also
Assertions#byLessThan(BigInteger)
isNotCloseToback to summary
public SELF isNotCloseTo(BigInteger expected, Percentage percentage)

Implements org.assertj.core.api.NumberAssert.isNotCloseTo.

Verifies that the actual number is not close to the given one by the given percentage.
If difference is equal to the percentage value, the assertion fails.

Example with BigInteger:

 import static org.assertj.core.api.Assertions.withinPercentage;

BigInteger eleven = new BigInteger("11");

// assertion will pass:
assertThat(eleven).isNotCloseTo(BigInteger.TEN, withinPercentage(5));

// assertion will fail as the difference is exactly equals to the computed offset (1)
assertThat(eleven).isNotCloseTo(BigInteger.TEN, withinPercentage(10));

// assertion will fail
assertThat(eleven).isNotCloseTo(BigInteger.TEN, withinPercentage(20));
Parameters
expected:BigInteger

the given number to compare the actual value to.

percentage:Percentage

the given positive percentage.

Returns:SELF

this assertion object.

Annotations
@Override
Exceptions
NullPointerException:
  • if the given offset is null.
  • if the expected number is null.
AssertionError:
if the actual value is close to the given one.
Since
2.7.0 / 3.7.0
isNotNegativeback to summary
public SELF isNotNegative()

Implements org.assertj.core.api.NumberAssert.isNotNegative.

Verifies that the actual value is non negative (positive or equal zero).

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isNotNegative();

// assertion will fail
assertThat(new BigInteger("-8")).isNotNegative();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isNotPositiveback to summary
public SELF isNotPositive()

Implements org.assertj.core.api.NumberAssert.isNotPositive.

Verifies that the actual value is non positive (negative or equal zero).

Example:

 // assertion will pass
assertThat(new BigInteger("-8")).isNotPositive();

// assertion will fail
assertThat(new BigInteger("8")).isNotPositive();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isNotZeroback to summary
public SELF isNotZero()

Implements org.assertj.core.api.NumberAssert.isNotZero.

Verifies that the actual value is not equal to zero.

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isNotZero();

// assertion will fail
assertThat(BigInteger.ZERO).isNotZero();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isOneback to summary
public SELF isOne()

Implements org.assertj.core.api.NumberAssert.isOne.

Verifies that the actual value is equal to one.

Example:

 // assertion will pass
assertThat(BigInteger.ONE).isOne();

// assertion will fail
assertThat(new BigInteger("8")).isOne();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isPositiveback to summary
public SELF isPositive()

Implements org.assertj.core.api.NumberAssert.isPositive.

Verifies that the actual value is positive.

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isPositive();

// assertion will fail
assertThat(new BigInteger("-8")).isPositive();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isStrictlyBetweenback to summary
public SELF isStrictlyBetween(BigInteger start, BigInteger end)

Overrides org.assertj.core.api.AbstractComparableAssert.isStrictlyBetween.

Implements org.assertj.core.api.NumberAssert.isStrictlyBetween, org.assertj.core.api.ComparableAssert.isStrictlyBetween.

Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).

Example:

 // assertion will pass
assertThat(new BigInteger("8")).isStrictlyBetween(new BigInteger("7"), new BigInteger("9"));

// assertions will fail
assertThat(new BigInteger("8")).isStrictlyBetween(new BigInteger("8"), new BigInteger("9"));
assertThat(new BigInteger("8")).isStrictlyBetween(new BigInteger("7"), new BigInteger("8"));
Parameters
start:BigInteger

Doc from org.assertj.core.api.NumberAssert.isStrictlyBetween.

the start value (exclusive), expected not to be null.

end:BigInteger

Doc from org.assertj.core.api.NumberAssert.isStrictlyBetween.

the end value (exclusive), expected not to be null.

Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
isZeroback to summary
public SELF isZero()

Implements org.assertj.core.api.NumberAssert.isZero.

Verifies that the actual value is equal to zero.

Example:

 // assertion will pass
assertThat(BigInteger.ZERO).isZero();

// assertion will fail
assertThat(new BigInteger("8")).isZero();
Returns:SELF

this assertion object.

Annotations
@Override
Since
2.7.0 / 3.7.0
usingComparatorback to summary
public SELF usingComparator(Comparator<? super BigInteger> customComparator)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Doc from org.assertj.core.api.AbstractAssert.usingComparator.

Use 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);
Parameters
customComparator:Comparator<? super BigInteger>

Doc from org.assertj.core.api.Assert.usingComparator.

the comparator to use for the incoming assertion checks.

Returns:SELF

Doc from org.assertj.core.api.Assert.usingComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue
usingComparatorback to summary
public SELF usingComparator(Comparator<? super BigInteger> customComparator, String customComparatorDescription)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Doc from org.assertj.core.api.AbstractAssert.usingComparator.

Use 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, "Hobbit Race Comparator").isEqualTo(sam);
Parameters
customComparator:Comparator<? super BigInteger>

Doc from org.assertj.core.api.Assert.usingComparator.

the comparator to use for the incoming assertion checks.

customComparatorDescription:String

Doc from org.assertj.core.api.Assert.usingComparator.

comparator description to be used in assertion error messages

Returns:SELF

Doc from org.assertj.core.api.Assert.usingComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue
usingDefaultComparatorback to summary
public SELF usingDefaultComparator()

Overrides org.assertj.core.api.AbstractComparableAssert.usingDefaultComparator.

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

Doc from org.assertj.core.api.AbstractAssert.usingDefaultComparator.

Revert to standard comparison for the incoming assertion checks.

This method should be used to disable a custom comparison strategy set by calling usingComparator.

Returns:SELF

Doc from org.assertj.core.api.Assert.usingDefaultComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue