Class ValueComparerTemplateBase
java.lang.Object
org.dbunit.assertion.comparer.value.ValueComparerBase
org.dbunit.assertion.comparer.value.ValueComparerTemplateBase
- All Implemented Interfaces:
ValueComparer
- Direct Known Subclasses:
IsActualContainingExpectedStringValueComparer,IsActualEqualToExpectedJsonValueComparer,IsActualEqualToExpectedValueComparer,IsActualEqualToExpectedWithEmptyFailMessageValueComparer,IsActualGreaterThanExpectedValueComparer,IsActualGreaterThanOrEqualToExpectedValueComparer,IsActualLessThanExpectedValueComparer,IsActualLessThanOrEqualToExpectedValueComparer,IsActualNotEqualToExpectedValueComparer,IsActualNotNullValueComparer,IsActualNullValueComparer,IsActualWithinToleranceOfExpectedTimestampValueComparer,NeverFailsValueComparer,TimestampIgnoreMillisValueComparerBase
Base class for
ValueComparers, providing template methods and common
elements.- Since:
- 2.6.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 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.protected abstract StringReturns the text snippet for substitution inValueComparerBase.BASE_FAIL_MSG.protected abstract 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 StringmakeFailMessage(Object expectedValue, Object actualValue) Makes the fail message usinggetFailPhrase().Methods inherited from class org.dbunit.assertion.comparer.value.ValueComparerBase
compare, toString
-
Constructor Details
-
ValueComparerTemplateBase
public ValueComparerTemplateBase()
-
-
Method Details
-
doCompare
protected 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. This implementation callsisExpected(ITable, ITable, int, String, DataType, Object, Object).- Specified by:
doComparein classValueComparerBase- 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:
- compare failure message or null if successful compare.
- Throws:
DatabaseUnitException- if the comparison cannot be performed.- See Also:
-
makeFailMessage
Makes the fail message usinggetFailPhrase().- Parameters:
expectedValue- the current expected value for the column.actualValue- the current actual value for the column.- Returns:
- the formatted fail message with the fail phrase.
-
isExpected
protected abstract boolean isExpected(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) throws DatabaseUnitException Determines whether the actual value compares as expected against the expected value.- 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.
-
getFailPhrase
Returns the text snippet for substitution inValueComparerBase.BASE_FAIL_MSG.- Returns:
- The text snippet for substitution in
ValueComparerBase.BASE_FAIL_MSG.
-