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 (gio, 04 dic 2008) $
- Author:
- gommma, Last changed by: $Author: gommma $
| Fields inherited from class org.dbunit.dataset.datatype.DataType |
BIGINT, BIGINT_AUX_LONG, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGNVARCHAR, LONGVARBINARY, LONGVARCHAR, NCHAR, NUMERIC, NVARCHAR, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR |
|
Method Summary |
protected int |
compareNonNulls(java.lang.Object value1cast,
java.lang.Object value2cast)
The only method overwritten from the base implementation to compare numbers allowing a tolerance |
ToleratedDeltaMap.Precision |
getToleratedDelta()
|
static boolean |
isZero(java.math.BigDecimal value)
Checks if the given value is zero. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
getToleratedDelta
public ToleratedDeltaMap.Precision getToleratedDelta()
compareNonNulls
protected int compareNonNulls(java.lang.Object value1cast,
java.lang.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(java.math.BigDecimal value)
- Checks if the given value is zero.
- Parameters:
value -
- Returns:
true if and only if the given value is zero.
Copyright © 2002-2010. All Rights Reserved.