Package org.dbunit

Interface VerifyTableDefinitionsProvider


public interface VerifyTableDefinitionsProvider
Computes a catalog's VerifyTableDefinitions for DbUnitConfig.verifyDefinitions() or DbUnitExpected.verifyDefinitions(), for the case where the definitions must be computed rather than declared as constants.

An org.dbunit.annotation provider or factory class: it is named on an annotation attribute by Class, instantiated once through its own public no-arg constructor, and asked for its one value - here getVerifyTableDefinitions(). The other members of this family are DataSetPathsProvider, DatabaseConfigPropertiesProvider, and DatabaseTesterFactory.

A catalog class named on either attribute is checked for this interface first: if it implements VerifyTableDefinitionsProvider, it is instantiated and asked for the definitions; otherwise the catalog's public static final VerifyTableDefinition fields are read directly and indexed by VerifyTableDefinition.getTableName(). A plain constants class - no interface, no boilerplate - is the common case; implementing this interface is the escape hatch for a catalog whose definitions cannot be plain constants.

The catalog machinery reflectively instantiating this interface caches an implementation's getVerifyTableDefinitions() result for the JVM's entire lifetime, keyed by the exact combination of catalog classes named together - see org.dbunit.annotation.runtime.VerifyTableDefinitionCatalog#forClasses. An implementation is therefore resolved once and reused by every later test naming the same combination, never called again; it must be a pure function of the catalog class itself, with no dependency on mutable external state that could legitimately differ between calls.

Since:
3.6.0
Author:
Jeff Jensen
See Also:
  • Method Details

    • getVerifyTableDefinitions

      VerifyTableDefinition[] getVerifyTableDefinitions()
      Returns the catalog's table definitions.
      Returns:
      The table definitions.