org.dbunit.dataset.datatype
Class NumberTolerantDataType
java.lang.Object
org.dbunit.dataset.datatype.DataType
org.dbunit.dataset.datatype.AbstractDataType
org.dbunit.dataset.datatype.NumberDataType
org.dbunit.dataset.datatype.NumberTolerantDataType
public class NumberTolerantDataType
- extends NumberDataType
Extended version of the NumberDataType
. Extends the
AbstractDataType.compare(Object, Object)
method in order to respect precision tolerance.
This is comparable to the JUnit method
assert(double val1, double val2, double toleratedDelta)
.
- Since:
- 2.3.0
- Version:
- $Revision: 909 $ $Date: 2008-12-04 21:20:00 +0100 (Thu, 04 Dec 2008) $
- Author:
- gommma, Last changed by: $Author: gommma $
Fields inherited from class org.dbunit.dataset.datatype.DataType |
BIGINT, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGVARBINARY, LONGVARCHAR, NUMERIC, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR |
getToleratedDelta
public ToleratedDeltaMap.Precision getToleratedDelta()
compareNonNulls
protected int compareNonNulls(Object value1cast,
Object value2cast)
throws TypeCastException
- The only method overwritten from the base implementation to compare numbers allowing a tolerance
- Overrides:
compareNonNulls
in class AbstractDataType
- Parameters:
value1cast
- First value resulting from the DataType.typeCast(Object)
method callvalue2cast
- Second value resulting from the DataType.typeCast(Object)
method call
- Returns:
- The result of the
Comparable.compareTo(Object)
invocation.
- Throws:
TypeCastException
- See Also:
AbstractDataType.compareNonNulls(java.lang.Object, java.lang.Object)
isZero
public static final boolean isZero(BigDecimal value)
- Checks if the given value is zero.
- Parameters:
value
-
- Returns:
true
if and only if the given value is zero.
Copyright © 2002-2012. All Rights Reserved.