rmpestano / dbunit-rules

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

CDI module should use @DataSet annotation #48

Closed rmpestano closed 8 years ago

rmpestano commented 8 years ago

Currently CDI module has it's own annotation @UsingDataSet which is a copy of @DataSet but with @InterceptorBinding to activate DBUnitInterceptor.

Remove @UsingDataSet in favor of @DataSet annotation.

DBUnitInterceptor should be activated by @DBUnitInterceptor annotation, ex:

@RunWith(CdiTestRunner.class)
@DBUnitInterceptor
public class CrudCDIIt {

    @Inject
    EntityManager em;

    @Test
    @DataSet("users.yml")
    public void shouldListUsers() {
        List<User> users = em.createQuery("select u from User u").getResultList();
        assertThat(users).isNotNull().isNotEmpty().hasSize(2);
    }

}