public class AbstractBigIntegerAssert<SELF extends AbstractBigIntegerAssert<SELF>> extends AbstractComparableAssert<SELF,BigInteger> implements NumberAssert<SELF,BigInteger>
BigInteger
s.actual, info, myself
Constructor and Description |
---|
AbstractBigIntegerAssert(BigInteger actual,
Class<?> selfType) |
Modifier and Type | Method and Description |
---|---|
SELF |
isBetween(BigInteger start,
BigInteger end)
Verifies that the actual value is in [start, end] range (start and end included).
|
SELF |
isCloseTo(BigInteger expected,
Offset<BigInteger> offset)
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. |
SELF |
isCloseTo(BigInteger 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. |
SELF |
isEqualTo(int expected)
Same as
isEqualTo(BigInteger) but takes care of converting given int to
BigInteger for you. |
SELF |
isEqualTo(long expected)
Same as
isEqualTo(BigInteger) but takes care of converting given int to
BigInteger for you. |
SELF |
isEqualTo(String expected)
Same as
isEqualTo(BigInteger) but takes care of converting given String to
BigInteger for you. |
SELF |
isNegative()
Verifies that the actual value is negative.
|
SELF |
isNotCloseTo(BigInteger expected,
Offset<BigInteger> offset)
Verifies that the actual number is not close to the given one by less than the given offset.
If the difference is equal to the offset value, the assertion fails. |
SELF |
isNotCloseTo(BigInteger expected,
Percentage percentage)
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. |
SELF |
isNotNegative()
Verifies that the actual value is non negative (positive or equal zero).
|
SELF |
isNotPositive()
Verifies that the actual value is non positive (negative or equal zero).
|
SELF |
isNotZero()
Verifies that the actual value is not equal to zero.
|
SELF |
isOne()
Verifies that the actual value is equal to one.
|
SELF |
isPositive()
Verifies that the actual value is positive.
|
SELF |
isStrictlyBetween(BigInteger start,
BigInteger end)
Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).
|
SELF |
isZero()
Verifies that the actual value is equal to zero.
|
SELF |
usingComparator(Comparator<? super BigInteger> customComparator)
Use given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
|
SELF |
usingDefaultComparator()
Revert to standard comparison for incoming assertion checks.
|
inBinary, inHexadecimal, isEqualByComparingTo, isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, isNotEqualByComparingTo
as, as, defaultTypeComparators, extracting, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, usingComparatorForFields, usingComparatorForType
asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasToString, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, setCustomRepresentation, throwAssertionError, withFailMessage, withRepresentation, withThreadDumpOnError
public AbstractBigIntegerAssert(BigInteger actual, Class<?> selfType)
public SELF isZero()
Example:
// assertion will pass
assertThat(BigInteger.ZERO).isZero();
// assertion will fail
assertThat(new BigInteger("8")).isZero();
isZero
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
public SELF isNotZero()
Example:
// assertion will pass
assertThat(new BigInteger("8")).isNotZero();
// assertion will fail
assertThat(BigInteger.ZERO).isNotZero();
isNotZero
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
public SELF isOne()
Example:
// assertion will pass
assertThat(BigInteger.ONE).isOne();
// assertion will fail
assertThat(new BigInteger("8")).isOne();
isOne
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
public SELF isPositive()
Example:
// assertion will pass
assertThat(new BigInteger("8")).isPositive();
// assertion will fail
assertThat(new BigInteger("-8")).isPositive();
isPositive
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
public SELF isNegative()
Example:
// assertion will pass
assertThat(new BigInteger("-8")).isNegative();
// assertion will fail
assertThat(new BigInteger("8")).isNegative();
isNegative
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
public SELF isNotNegative()
Example:
// assertion will pass
assertThat(new BigInteger("8")).isNotNegative();
// assertion will fail
assertThat(new BigInteger("-8")).isNotNegative();
isNotNegative
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
this
assertion object.public SELF isNotPositive()
Example:
// assertion will pass
assertThat(new BigInteger("-8")).isNotPositive();
// assertion will fail
assertThat(new BigInteger("8")).isNotPositive();
isNotPositive
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
this
assertion object.public SELF isCloseTo(BigInteger expected, Offset<BigInteger> offset)
Example:
import static org.assertj.core.api.Assertions.within;
final BigInteger actual = new BigInteger("8");
final BigInteger other = new BigInteger("10");
// valid assertion
assertThat(actual).isCloseTo(other, within(new BigInteger("3")));
// if difference is exactly equals to given offset value, it's ok
assertThat(actual).isCloseTo(other, within(new BigInteger("2")));
// but if difference is greater than given offset value assertion will fail :
assertThat(actual).isCloseTo(other, within(new BigInteger("1")));
isCloseTo
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
expected
- the given number to compare the actual value to.offset
- the given positive offset.this
assertion object.NullPointerException
- if the given offset is null
.NullPointerException
- if the expected number is null
.AssertionError
- if the actual value is not close to the given one.public SELF isNotCloseTo(BigInteger expected, Offset<BigInteger> offset)
Example:
import static org.assertj.core.api.Assertions.byLessThan;
final BigInteger actual = new BigInteger("8");
final BigInteger other = new BigInteger("10");
// this assertion succeeds
assertThat(actual).isNotCloseTo(other, byLessThan(new BigInteger("1")));
// the assertion fails if the difference is equal to the given offset value
assertThat(actual).isNotCloseTo(other, byLessThan(new BigInteger("2")));
// the assertion fails if the difference is greater than the given offset value
assertThat(actual).isNotCloseTo(other, byLessThan(new BigInteger("3")));
isNotCloseTo
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
expected
- the given number to compare the actual value to.offset
- the given positive offset.this
assertion object.NullPointerException
- if the given offset is null
.NullPointerException
- if the expected number is null
.AssertionError
- if the actual value is close to the given one within the offset value.Assertions.byLessThan(BigInteger)
public SELF isCloseTo(BigInteger expected, Percentage percentage)
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));
isCloseTo
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
expected
- the given number to compare the actual value to.percentage
- the given positive percentage.this
assertion object.NullPointerException
- if the given offset is null
.NullPointerException
- if the expected number is null
.AssertionError
- if the actual value is not close to the given one.public SELF isNotCloseTo(BigInteger expected, Percentage percentage)
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));
isNotCloseTo
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
expected
- the given number to compare the actual value to.percentage
- the given positive percentage.this
assertion object.NullPointerException
- if the given offset is null
.NullPointerException
- if the expected number is null
.AssertionError
- if the actual value is close to the given one.public SELF isBetween(BigInteger start, BigInteger end)
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"));
isBetween
in interface ComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
isBetween
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
isBetween
in class AbstractComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
start
- the start value (inclusive), expected not to be null.end
- the end value (inclusive), expected not to be null.public SELF isStrictlyBetween(BigInteger start, BigInteger end)
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"));
isStrictlyBetween
in interface ComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
isStrictlyBetween
in interface NumberAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
isStrictlyBetween
in class AbstractComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
start
- the start value (exclusive), expected not to be null.end
- the end value (exclusive), expected not to be null.public SELF isEqualTo(String expected)
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");
public SELF isEqualTo(int expected)
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);
public SELF isEqualTo(long expected)
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);
public SELF usingComparator(Comparator<? super BigInteger> customComparator)
AbstractAssert
Custom comparator is bound to assertion instance, meaning that if a new assertion is created, it will use default comparison strategy. Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :).
// raceComparator implements Comparator<Character>
assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);
usingComparator
in interface Assert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
usingComparator
in class AbstractComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
customComparator
- the comparator to use for incoming assertion checks.this
assertion object.public SELF usingDefaultComparator()
AbstractAssert
This method should be used to disable a custom comparison strategy set by calling
Assert.usingComparator(Comparator)
.
usingDefaultComparator
in interface Assert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
usingDefaultComparator
in class AbstractComparableAssert<SELF extends AbstractBigIntegerAssert<SELF>,BigInteger>
this
assertion object.Copyright © 2013–2017 AssertJ. All rights reserved.