View Javadoc
1   package org.dbunit.assertion.comparer.value;
2   
3   import org.dbunit.DatabaseUnitException;
4   import org.dbunit.dataset.ITable;
5   import org.dbunit.dataset.datatype.DataType;
6   import org.dbunit.dataset.datatype.TypeCastException;
7   
8   /**
9    * Strategy for comparing values.
10   *
11   * @author jjensen
12   * @since 2.6.0
13   */
14  // @FunctionalInterface
15  public interface ValueComparer
16  {
17      /**
18       * Compare expected and actual values.
19       *
20       * @param expectedTable
21       *            Table containing all expected results.
22       * @param actualTable
23       *            Table containing all actual results.
24       * @param rowNum
25       *            The current row number comparing.
26       * @param columnName
27       *            The name of the current column comparing.
28       * @param dataType
29       *            The {@link DataType} for the current column comparing. Use
30       *            {@link DataType#compare(Object, Object)} for equal, not equal,
31       *            less than, and greater than comparisons.
32       * @param expectedValue
33       *            The current expected value for the column.
34       * @param actualValue
35       *            The current actual value for the column.
36       * @return compare failure message or null if successful compare.
37       * @throws TypeCastException
38       */
39      String compare(ITable expectedTable, ITable actualTable, int rowNum,
40              String columnName, DataType dataType, Object expectedValue,
41              Object actualValue) throws DatabaseUnitException;
42  }