org.unitils.dbunit.dataset.comparison
Class TableDifference

java.lang.Object
  extended by org.unitils.dbunit.dataset.comparison.TableDifference

public class TableDifference
extends Object

The differences between 2 data set tables.

Author:
Tim Ducheyne, Filip Neven

Constructor Summary
TableDifference(Table table, Table actualTable)
          Creates a table difference.
 
Method Summary
 void addMissingRow(Row missingRow)
          Adds a rows for which no other row was found in the actual table.
 Table getActualTable()
           
 RowDifference getBestRowDifference(Row row)
           
 List<RowDifference> getBestRowDifferences()
           
 List<Row> getMissingRows()
           
 Table getTable()
           
 boolean isMatch()
           
 void setIfBestRowDifference(RowDifference rowDifference)
          Sets the given difference as best row difference if it is better than the current best row difference.
 void setMatchingRow(Row row, Row actualRow)
          Indicates a match for the given row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableDifference

public TableDifference(Table table,
                       Table actualTable)
Creates a table difference.

Parameters:
table - The expected table, not null
actualTable - The actual table, not null
Method Detail

getTable

public Table getTable()
Returns:
The expected table, not null

getActualTable

public Table getActualTable()
Returns:
The actual table, null if the table was not found

getMissingRows

public List<Row> getMissingRows()
Returns:
The rows for which no other row was found in the actual table, empty if none found

addMissingRow

public void addMissingRow(Row missingRow)
Adds a rows for which no other row was found in the actual table.

Parameters:
missingRow - The missing row, not null

getBestRowDifferences

public List<RowDifference> getBestRowDifferences()
Returns:
The best results in the comparison between the rows, not null

getBestRowDifference

public RowDifference getBestRowDifference(Row row)
Parameters:
row - The row to get the difference for, not null
Returns:
The best difference, null if not found or if there was a match

setMatchingRow

public void setMatchingRow(Row row,
                           Row actualRow)
Indicates a match for the given row.

Parameters:
row - The row, not null
actualRow - The matching actual row, not null

setIfBestRowDifference

public void setIfBestRowDifference(RowDifference rowDifference)
Sets the given difference as best row difference if it is better than the current best row difference.

Parameters:
rowDifference - The difference, null for a match

isMatch

public boolean isMatch()
Returns:
True if both tables are a match


Copyright © 2011. All Rights Reserved.