View Javadoc
1   package org.dbunit.assertion.comparer.value;
2   
3   import org.dbunit.DatabaseUnitException;
4   import org.dbunit.assertion.DbUnitAssert;
5   import org.dbunit.assertion.Difference;
6   import org.dbunit.dataset.ITable;
7   import org.dbunit.dataset.datatype.DataType;
8   
9   /**
10   * {@link ValueComparer} implementation that verifies actual value is equal to
11   * expected value and sets fail message to empty String.
12   *
13   * This is primarily for the original assertEquals(*) on {@link DbUnitAssert} so
14   * the {@link Difference} message stays the same.
15   *
16   * @author jjensen
17   * @since 2.6.0
18   */
19  public class IsActualEqualToExpectedWithEmptyFailMessageValueComparer
20          extends ValueComparerTemplateBase
21  {
22      @Override
23      protected boolean isExpected(final ITable expectedTable,
24              final ITable actualTable, final int rowNum, final String columnName,
25              final DataType dataType, final Object expectedValue,
26              final Object actualValue) throws DatabaseUnitException
27      {
28          return dataType.compare(actualValue, expectedValue) == 0;
29      }
30  
31      @Override
32      protected String makeFailMessage(final Object expectedValue,
33              final Object actualValue)
34      {
35          return "";
36      }
37  
38      @Override
39      protected String getFailPhrase()
40      {
41          return null;
42      }
43  }