All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dbunit.assertion.comparer.value.ValueComparer Maven / Gradle / Ivy

Go to download

dbUnit is a JUnit extension (also usable from Ant and Maven) targeted for database-driven projects that, among other things, puts your database into a known state between test runs. This is an excellent way to avoid the myriad of problems that can occur when one test case corrupts the database and causes subsequent tests to fail or exacerbate the damage.

There is a newer version: 2.8.0
Show newest version
package org.dbunit.assertion.comparer.value;

import org.dbunit.DatabaseUnitException;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.datatype.DataType;

/**
 * Strategy for comparing values.
 *
 * @author Jeff Jensen
 * @since 2.6.0
 */
@FunctionalInterface
public interface ValueComparer
{
    /**
     * Compare expected and actual values.
     *
     * @param expectedTable
     *            Table containing all expected results.
     * @param actualTable
     *            Table containing all actual results.
     * @param rowNum
     *            The current row number comparing.
     * @param columnName
     *            The name of the current column comparing.
     * @param dataType
     *            The {@link DataType} for the current column comparing. Use
     *            {@link DataType#compare(Object, Object)} for equal, not equal,
     *            less than, and greater than comparisons.
     * @param expectedValue
     *            The current expected value for the column.
     * @param actualValue
     *            The current actual value for the column.
     * @return compare failure message or null if successful compare.
     * @throws DatabaseUnitException
     */
    String compare(ITable expectedTable, ITable actualTable, int rowNum,
            String columnName, DataType dataType, Object expectedValue,
            Object actualValue) throws DatabaseUnitException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy