Class RowCountSnapshot

java.lang.Object
org.dbunit.database.rowcount.RowCountSnapshot

public class RowCountSnapshot extends Object
Immutable snapshot of table row counts, keyed by table name, taken at one point in a RowCountCheck. Holds no connection and issues no SQL of its own; it is built from the map a RowCounter already returned.
Since:
3.6.0
Author:
dbunit
  • Constructor Details

    • RowCountSnapshot

      public RowCountSnapshot(Map<String,Integer> rowCounts)
      Creates a snapshot from a RowCounter's result.
      Parameters:
      rowCounts - The row count of each table, keyed by table name; copied, not retained.
  • Method Details

    • getRowCounts

      public Map<String,Integer> getRowCounts()
      Returns the row count of each table in this snapshot.
      Returns:
      An unmodifiable map of row count keyed by table name.
    • difference

      public List<RowCountDifference> difference(RowCountSnapshot current)
      Compares this snapshot, used as the baseline, against a snapshot captured later. Does not assume the two snapshots share the identical key set: a table absent from one side - e.g. dropped or created between the two captures, or the two connections behind them not enumerating identically - counts as 0 on that side rather than throwing, so the difference is reported like any other rather than failing with a NullPointerException.
      Parameters:
      current - The snapshot to compare this baseline against.
      Returns:
      One RowCountDifference per table whose count changed, in this snapshot's table order followed by any table current has that this snapshot does not, in current's order; empty when every count is unchanged.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object