org.assertj.core.api
Interface NumberAssert<S extends NumberAssert<S,A>,A extends Number>

Type Parameters:
S - the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
A - the type of the "actual" value.
All Known Subinterfaces:
FloatingPointNumberAssert<S,A>
All Known Implementing Classes:
AbstractBigDecimalAssert, AbstractByteAssert, AbstractDoubleAssert, AbstractFloatAssert, AbstractIntegerAssert, AbstractLongAssert, AbstractShortAssert, BigDecimalAssert, ByteAssert, DoubleAssert, FloatAssert, IntegerAssert, LongAssert, ShortAssert

public interface NumberAssert<S extends NumberAssert<S,A>,A extends Number>

Assertion methods applicable to Numbers.

Author:
Alex Ruiz, Nicolas François, Mikhail Mazursky

Method Summary
 S isBetween(A start, A end)
          Verifies that the actual value is in [start, end] range (start included, end included).
 S isNegative()
          Verifies that the actual value is negative.
 S isNotNegative()
          Verifies that the actual value is non negative (positive or equal zero).
 S isNotPositive()
          Verifies that the actual value is non positive (negative or equal zero).
 S isNotZero()
          Verifies that the actual value is not equal to zero.
 S isPositive()
          Verifies that the actual value is positive.
 S isStrictlyBetween(A start, A end)
          Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).
 S isZero()
          Verifies that the actual value is equal to zero.
 

Method Detail

isZero

S isZero()
Verifies that the actual value is equal to zero.

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is not equal to zero.

isNotZero

S isNotZero()
Verifies that the actual value is not equal to zero.

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is equal to zero.

isPositive

S isPositive()
Verifies that the actual value is positive.

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is not positive.

isNegative

S isNegative()
Verifies that the actual value is negative.

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is not negative.

isNotNegative

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

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is not non negative.

isNotPositive

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

Returns:
this assertion object.
Throws:
AssertionError - if the actual value is null.
AssertionError - if the actual value is not non positive.

isBetween

S isBetween(A start,
            A end)
Verifies that the actual value is in [start, end] range (start included, end included).
 // these assertions succeed ... 
 assertThat(12).isBetween(10, 14);
 assertThat(12).isBetween(12, 14);
 assertThat(12).isBetween(10, 12);
 
 // ... but these one fails
 assertThat(12).isBetween(14, 16);
 

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.
Throws:
AssertionError - if the actual value is null.
NullPointerException - if start value is null.
NullPointerException - if end value is null.
AssertionError - if the actual value is not in [start, end] range.

isStrictlyBetween

S isStrictlyBetween(A start,
                    A end)
Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).
 // this assertion succeeds ... 
 assertThat(12).isBetween(10, 14);
 
 // ... but these one fails
 assertThat(12).isBetween(12, 14);
 assertThat(12).isBetween(10, 12);
 assertThat(12).isBetween(16, 18);
 

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.
Throws:
AssertionError - if the actual value is null.
NullPointerException - if start value is null.
NullPointerException - if end value is null.
AssertionError - if the actual value is not in ]start, end[ range.


Copyright © 2013–2015 AssertJ. All rights reserved.