Class ConditionalSetBiValueComparer<T>
java.lang.Object
org.dbunit.assertion.comparer.value.ValueComparerBase
org.dbunit.assertion.comparer.value.ConditionalSetBiValueComparer<T>
- Type Parameters:
T- The type of the value used to determine whichValueComparerto use.
- All Implemented Interfaces:
ValueComparer
Use one of two
ValueComparers based on a value present or not in a
set of values.
When the value returned by the
actualValueFactory is in
values, use the
inValuesValueComparer on the row;
otherwise, use the
notInValuesValueComparer on the row.- Since:
- 2.6.0
- Author:
- Jeff Jensen
-
Field Summary
Fields inherited from class org.dbunit.assertion.comparer.value.ValueComparerBase
BASE_FAIL_MSG -
Constructor Summary
ConstructorsConstructorDescriptionConditionalSetBiValueComparer(ValueFactory<T> actualValueFactory, Set<T> values, ValueComparer inValuesValueComparer, ValueComparer notInValuesValueComparer) Creates a comparer that selects between twoValueComparers based on whether a value derived from the actual row is present in a set of values. -
Method Summary
Modifier and TypeMethodDescriptiondoCompare(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 booleanisActualValueInValues(ITable actualTable, int rowNum) Returns whether the value derived from the given row of the actual table is present invalues.toString()Methods inherited from class org.dbunit.assertion.comparer.value.ValueComparerBase
compare
-
Constructor Details
-
ConditionalSetBiValueComparer
public ConditionalSetBiValueComparer(ValueFactory<T> actualValueFactory, Set<T> values, ValueComparer inValuesValueComparer, ValueComparer notInValuesValueComparer) Creates a comparer that selects between twoValueComparers based on whether a value derived from the actual row is present in a set of values.- Parameters:
actualValueFactory- Factory to make the value to lookup in the values list.values- List of values that mean to use the inValuesValueComparer.inValuesValueComparer- TheValueComparerused when the value from the actualValueFactory is in the values map.notInValuesValueComparer- TheValueComparerused when the value from the actualValueFactory is not in the values map.
-
-
Method Details
-
doCompare
public String doCompare(ITable expectedTable, ITable actualTable, int rowNum, String columnName, DataType dataType, Object expectedValue, Object actualValue) throws DatabaseUnitException Description copied from class:ValueComparerBaseDo the comparison and return a fail message or null if comparison passes.- 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:
-
isActualValueInValues
Returns whether the value derived from the given row of the actual table is present invalues.- Parameters:
actualTable- the actual table to derive the value from.rowNum- the row number to derive the value from.- Returns:
trueif the derived value is present invalues.- Throws:
DataSetException- if the value cannot be derived from the actual table.
-
toString
- Overrides:
toStringin classValueComparerBase
-