Package org.assertj.core.api
Class ComparatorFactory
java.lang.Object
org.assertj.core.api.ComparatorFactory
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T extends Number>
BigDecimalasBigDecimal
(T number) Convert to a precise BigDecimal object using an intermediate String.doubleComparatorWithPrecision
(double precision) floatComparatorWithPrecision
(float precision) private static <T extends Number>
booleanisWithinPrecision
(T actual, T expected, T precision) Returns true if the abs(expected - precision) is <= precision, false otherwise.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
ComparatorFactory
public ComparatorFactory()
-
-
Method Details
-
doubleComparatorWithPrecision
-
floatComparatorWithPrecision
-
asBigDecimal
Convert to a precise BigDecimal object using an intermediate String.- Type Parameters:
T
- type of expected and precision, which should be the subclass of java.lang.Number and java.lang.Comparable- Parameters:
number
- the Number to convert- Returns:
- the built BigDecimal
-
isWithinPrecision
Returns true if the abs(expected - precision) is <= precision, false otherwise.- Type Parameters:
T
- type of number to compare including the precision- Parameters:
actual
- the actual valueexpected
- the expected valueprecision
- the acceptable precision- Returns:
- whether true if the abs(expected - precision) is <= precision, false otherwise.
-