Interface DataSetProvider


public interface DataSetProvider
A provider of IDataSet instances for DbUnit tests.

Implementations of this interface are responsible for creating and returning a fully initialized IDataSet that will be used during database setup or verification. This allows consumers of the API to load DbUnit datasets programmatically (for example, by reading from a file, building an in-memory dataset, or querying another source).

Implementation notes:

  • Each implementation must declare a public no-argument constructor.
  • Implementations may construct the dataset lazily or eagerly, depending on performance or memory needs.

Typical usage:

public class MyDataSetProvider implements DataSetProvider {
    @Override
    public IDataSet get() throws Exception {
        // Build and return an IDataSet instance
    }
}
  • Method Summary

    Modifier and Type
    Method
    Description
    org.dbunit.dataset.IDataSet
    get()
    Returns a DbUnit IDataSet to be used by the test framework.
  • Method Details

    • get

      org.dbunit.dataset.IDataSet get() throws Exception
      Returns a DbUnit IDataSet to be used by the test framework.

      This method will be invoked each time a dataset is required. It should construct and return a new or cached IDataSet, depending on the needs of the implementation.

      Returns:
      a fully constructed IDataSet instance.
      Throws:
      Exception - if an error occurs while creating or loading the dataset.