rmpestano / dbunit-rules

https://github.com/database-rider/database-rider
15 stars 5 forks source link

support empty datasets #32

Closed rmpestano closed 8 years ago

rmpestano commented 8 years ago

Currently empty datasets are not supported.They are extremely useful for dataset comparison where e.g you expect an empty table after rows where deleted in test:

empty.yml

user:

follower:

tweet:

user.yml

user:
  - id: 1
    name: "@realpestano"
  - id: 2
    name: "@dbunit"

the test:

    @Test
    @DataSet(value = "yml/user.yml", disableConstraints = true)
    @ExpectedDataSet(value = "yml/empty.yml")
    public void shouldMatchEmptyYmlDataSet() {
        tx().begin();
        em().remove(em().find(User.class,1L));
        em().remove(em().find(User.class,2L));
        tx().commit();
    }