Package org.fest.assertions.internal
Class Numbers<NUMBER extends java.lang.Comparable<NUMBER>>
- java.lang.Object
-
- org.fest.assertions.internal.Comparables
-
- org.fest.assertions.internal.Numbers<NUMBER>
-
- Direct Known Subclasses:
BigDecimals
,Bytes
,Integers
,Longs
,RealNumbers
,Shorts
public abstract class Numbers<NUMBER extends java.lang.Comparable<NUMBER>> extends Comparables
Base class of reusable assertions for numbers.- Author:
- Joel Costigliola, Nicolas François
-
-
Constructor Summary
Constructors Constructor Description Numbers()
Numbers(ComparisonStrategy comparisonStrategy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
assertIsNegative(AssertionInfo info, NUMBER actual)
Asserts that the actual value is negative.void
assertIsNotNegative(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not negative.void
assertIsNotPositive(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not positive.void
assertIsNotZero(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not equal to zero.
It does not rely on the custom comparisonStrategy (if one is set).void
assertIsPositive(AssertionInfo info, NUMBER actual)
Asserts that the actual value is positive.void
assertIsZero(AssertionInfo info, NUMBER actual)
Asserts that the actual value is equal to zero.
It does not rely on the custom comparisonStrategy (if one is set).protected abstract NUMBER
zero()
-
Methods inherited from class org.fest.assertions.internal.Comparables
areEqual, assertEqual, assertEqualByComparison, assertGreaterThan, assertGreaterThanOrEqualTo, assertLessThan, assertLessThanOrEqualTo, assertNotEqual, assertNotEqualByComparison, assertNotNull, getComparator, instance
-
-
-
-
Constructor Detail
-
Numbers
public Numbers()
-
Numbers
public Numbers(ComparisonStrategy comparisonStrategy)
-
-
Method Detail
-
zero
protected abstract NUMBER zero()
-
assertIsZero
public void assertIsZero(AssertionInfo info, NUMBER actual)
Asserts that the actual value is equal to zero.
It does not rely on the custom comparisonStrategy (if one is set).- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is not equal to zero.
-
assertIsNotZero
public void assertIsNotZero(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not equal to zero.
It does not rely on the custom comparisonStrategy (if one is set).- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is equal to zero.
-
assertIsNegative
public void assertIsNegative(AssertionInfo info, NUMBER actual)
Asserts that the actual value is negative.- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is not negative: it is either equal to or greater than zero.
-
assertIsPositive
public void assertIsPositive(AssertionInfo info, NUMBER actual)
Asserts that the actual value is positive.- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is not positive: it is either equal to or less than zero.
-
assertIsNotNegative
public void assertIsNotNegative(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not negative.- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is negative.
-
assertIsNotPositive
public void assertIsNotPositive(AssertionInfo info, NUMBER actual)
Asserts that the actual value is not positive.- Parameters:
info
- contains information about the assertion.actual
- the actual value.- Throws:
java.lang.AssertionError
- if the actual value isnull
.java.lang.AssertionError
- if the actual value is positive.
-
-