Package 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
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$ $Date$
- Author:
- gommma, Last changed by: $Author$
-
Field Summary
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, RELATIVE_DATE_TIME_PARSER, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareNonNulls(Object value1cast, Object value2cast) The only method overwritten from the base implementation to compare numbers allowing a tolerancestatic final booleanisZero(BigDecimal value) Checks if the given value is zero.Methods inherited from class org.dbunit.dataset.datatype.NumberDataType
getSqlValue, setSqlValue, typeCastMethods inherited from class org.dbunit.dataset.datatype.AbstractDataType
areObjectsEqual, compare, getSqlType, getTypeClass, isDateTime, isNumber, loadClass, loadClass, toStringMethods inherited from class org.dbunit.dataset.datatype.DataType
asString, forObject, forSqlType, forSqlTypeName, getSqlTypeName, isExtendedSyntax
-
Method Details
-
getToleratedDelta
-
compareNonNulls
The only method overwritten from the base implementation to compare numbers allowing a tolerance- Overrides:
compareNonNullsin classAbstractDataType- Parameters:
value1cast- First value resulting from theDataType.typeCast(Object)method callvalue2cast- Second value resulting from theDataType.typeCast(Object)method call- Returns:
- The result of the
Comparable.compareTo(Object)invocation. - Throws:
TypeCastException- See Also:
-
isZero
Checks if the given value is zero.- Parameters:
value-- Returns:
trueif and only if the given value is zero.
-