Class ValueComparerBase
java.lang.Object
org.dbunit.assertion.comparer.value.ValueComparerBase
- All Implemented Interfaces:
ValueComparer
- Direct Known Subclasses:
ConditionalSelectorMultiValueComparer,ConditionalSetBiValueComparer,ValueComparerTemplateBase
Base class for
ValueComparers providing a template method and common
elements, mainly consistent log message and toString.- Since:
- 2.6.0
- Author:
- Jeff Jensen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFormat String for consistent fail message; substitution strings are: actual, fail phrase, expected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompare(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) Compare expected and actual values.protected abstract StringdoCompare(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) Do the comparison and return a fail message or null if comparison passes.toString()
-
Field Details
-
BASE_FAIL_MSG
Format String for consistent fail message; substitution strings are: actual, fail phrase, expected.- See Also:
-
-
Constructor Details
-
ValueComparerBase
public ValueComparerBase()
-
-
Method Details
-
compare
public String compare(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) throws DatabaseUnitException Compare expected and actual values. This implementation callsdoCompare(ITable, ITable, int, String, DataType, Object, Object).- Specified by:
comparein interfaceValueComparer- 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. UseDataType.compare(Object, Object)for equal, not equal, less than, and greater than comparisons.expectedValue- The current expected value for the column.actualValue- The current actual value for the column.- Returns:
- compare failure message or null if successful compare.
- Throws:
DatabaseUnitException
-
doCompare
protected abstract String doCompare(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) throws DatabaseUnitException Do the comparison and return a fail message or null if comparison passes.- Throws:
DatabaseUnitException- See Also:
-
toString
-