Class TimestampIgnoreMillisValueComparerBase
java.lang.Object
org.dbunit.assertion.comparer.value.ValueComparerBase
org.dbunit.assertion.comparer.value.ValueComparerTemplateBase
org.dbunit.assertion.comparer.value.TimestampIgnoreMillisValueComparerBase
- All Implemented Interfaces:
ValueComparer
- Direct Known Subclasses:
IsActualGreaterThanExpectedWithIgnoreMillisValueComparer,IsActualGreaterThanOrEqualToExpectedWithIgnoreMillisValueComparer
Base class for
ValueComparer implementations that verify Timestamps,
ignoring the milliseconds.- Since:
- 3.1.0
- Author:
- Jeff Jensen
-
Field Summary
Fields inherited from class org.dbunit.assertion.comparer.value.ValueComparerBase
BASE_FAIL_MSG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longconvertValueToTimeInMillis(Object timestampValue) Converts the given value to milliseconds since the epoch.protected booleanisExpected(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) Determines whether the actual value compares as expected against the expected value.protected booleanisExpectedWithNull(Object expectedValue, Object actualValue) Determines whether the actual value matches the expected value when at least one of them isnull.protected booleanisExpectedWithoutNull(DataType dataType, Object expectedValue, Object actualValue) Determines whether the actual value matches the expected value, ignoring milliseconds, given that neither isnull.Methods inherited from class org.dbunit.assertion.comparer.value.ValueComparerTemplateBase
doCompare, getFailPhrase, makeFailMessageMethods inherited from class org.dbunit.assertion.comparer.value.ValueComparerBase
compare, toString
-
Constructor Details
-
TimestampIgnoreMillisValueComparerBase
public TimestampIgnoreMillisValueComparerBase()
-
-
Method Details
-
isExpected
protected boolean isExpected(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) throws DatabaseUnitException Description copied from class:ValueComparerTemplateBaseDetermines whether the actual value compares as expected against the expected value.- Specified by:
isExpectedin classValueComparerTemplateBase- Parameters:
expectedTable- Table containing all expected results.actualTable- Table containing all actual results.rowNum- The current row number comparing.columnName- The name of the current column comparing.dataType- TheDataTypefor the current column comparing.expectedValue- The current expected value for the column.actualValue- The current actual value for the column.- Returns:
- true if comparing actual to expected is as expected.
- Throws:
DatabaseUnitException- if the comparison cannot be performed.
-
isExpectedWithNull
Determines whether the actual value matches the expected value when at least one of them isnull.- Parameters:
expectedValue- the expected value, possiblynull.actualValue- the actual value, possiblynull.- Returns:
trueif the values are considered equal.
-
isExpectedWithoutNull
protected boolean isExpectedWithoutNull(DataType dataType, Object expectedValue, Object actualValue) throws TypeCastException Determines whether the actual value matches the expected value, ignoring milliseconds, given that neither isnull.- Parameters:
dataType- the column's data type.expectedValue- the expected value, nevernull.actualValue- the actual value, nevernull.- Returns:
trueif the values are considered equal, ignoring milliseconds.- Throws:
TypeCastException- if a value cannot be converted for comparison.
-
convertValueToTimeInMillis
Converts the given value to milliseconds since the epoch.
-