@@ -0,0 +1,2224 @@
+package com.github.database.rider.core;%0A%0Aimport com.github.database.rider.core.api.configuration.DBUnit;%0Aimport com.github.database.rider.core.api.dataset.DataSet;%0Aimport com.github.database.rider.core.model.User;%0Aimport com.github.database.rider.core.util.EntityManagerProvider;%0Aimport org.junit.AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0A%0Aimport javax.persistence.EntityManager;%0Aimport java.util.List;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.assertj.core.api.Assertions.fail;%0A%0A/**%0A * Created by pestano on 26/02/16.%0A */%0A@RunWith(JUnit4.class)%0Apublic class AlwaysCleanBeforeAfterIt %7B%0A%0A    @Rule%0A    public DBUnitRule dbUnitRule = DBUnitRule.instance(EntityManagerProvider.instance(%22rules-it%22).connection());%0A%0A%0A    @BeforeClass%0A    public static void before()%7B%0A        EntityManager em = EntityManagerProvider.instance(%22rules-it%22).em();%0A        em.getTransaction().begin();%0A        em.createNativeQuery(%22DELETE FROM USER%22).executeUpdate();%0A        em.createNativeQuery(%22INSERT INTO USER VALUES (6,'user6')%22).executeUpdate();%0A        em.flush();%0A        em.getTransaction().commit();%0A        List%3CUser%3E users = em.createQuery(%22select u from User u%22).getResultList();%0A        assertThat(users).isNotNull().hasSize(1);%0A%0A    %7D%0A%0A    @AfterClass%0A    public static void after()%7B%0A        List%3CUser%3E users = EntityManagerProvider.instance(%22rules-it%22).em().createQuery(%22select u from User u%22).getResultList();%0A        if(users != null && !users.isEmpty())%7B%0A            fail(%22users should be empty%22);%0A        %7D%0A    %7D%0A%0A%0A    @Test%0A    @DataSet(value = %22datasets/yml/users.yml%22)%0A    @DBUnit(alwaysCleanAfter = true, alwaysCleanBefore = true)%0A    public void shouldCleanDatabaseBefore() %7B%0A        List%3CUser%3E users = EntityManagerProvider.instance(%22rules-it%22).em().createQuery(%22select u from User u%22).getResultList();%0A        assertThat(users).isNotNull().hasSize(2);//dataset has 2 users, user inserted in @Before must not be present%0A        User userInsertedInBefore = new User(6);//user inserted in @before has id 6%0A        assertThat(users).doesNotContain(userInsertedInBefore);%0A    %7D%0A%0A%7D%0A

Add test for alwaysCleanAfter and alwaysCleanBefore