Annotation Type DbUnitDataSet


@Retention(RUNTIME) @Inherited @Documented @Target({METHOD,TYPE}) public @interface DbUnitDataSet
Data set annotation, used to specify which data set should be loaded for the next test. This annotation can be used on:
  • Method (i.e test method).
  • Class (i.e test class).
  • Package (i.e package where test classes belongs)
For example:


  @DbUnitDataSet("/dataset/xml")
   public class TestClass {
     @Rule
     public DbUnitRule rule = new DbUnitRule(connectionFactory);

     @Test
     public void test1() {
     }

     @Test
     @DbUnitDataSet("/dataset/xml/table1.xml")
     public void test2() {
     }
   }

 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    A flag indicating if given annotation should be merged with "parent" annotations.
    Set of data set file to load.
  • Element Details

    • value

      String[] value
      Set of data set file to load.
      Returns:
      DataSet file to load.
      Default:
      {}
    • inherit

      boolean inherit
      A flag indicating if given annotation should be merged with "parent" annotations. For example, a method can define additional dataset to load than the dataset defined at class level. The default value is false (mainly for retro-compatibility reasons). This means that the dataset for the annotated method or class will shadow and effectively replace any datasets defined by superclasses. If this flag is set to true, this means that an annotated method or class will inherit the datasets defined by test superclasses (or meta-annotations).
      Returns:
      The inherit flag value.
      Default:
      false