FIX: Clean up before running tests - otherwise tests will fail if a previous test did not clean up well. (This fixes test failures in Eclipse where tests are executed in different order than in maven) (#1089)

This commit is contained in:
Roland Praml
2017-08-30 17:44:30 +12:00
committed by Rob Bygrave
parent ff496ad2d3
commit a5bcd49ecb
6 changed files with 34 additions and 1 deletions
@@ -6,6 +6,7 @@ import org.tests.inherit.ChildA;
import org.tests.inherit.ChildB;
import org.tests.inherit.Data;
import org.tests.inherit.Parent;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
@@ -16,6 +17,14 @@ import static org.junit.Assert.assertNotNull;
public class ParentQueryTest extends BaseTestCase {
@Before
public void clearDb() {
Ebean.deleteAll(Ebean.find(Data.class).findList());
//@rob: this does not work as it does not clear the ManyToMany relations.
//Ebean.find(Data.class).delete();
Ebean.find(Parent.class).delete();
}
@Test
public void QueryParentCollectionFetch() {
@@ -11,6 +11,7 @@ import org.tests.inherit.Data;
import org.tests.inherit.EUncle;
import org.tests.inherit.Parent;
import org.tests.inherit.ParentAggregate;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
@@ -20,6 +21,14 @@ import static org.junit.Assert.*;
public class ParentRawSqlTest extends BaseTestCase {
@Before
public void clearDb() {
Ebean.deleteAll(Ebean.find(Data.class).findList());
//@rob: this does not work as it does not clear the ManyToMany relations.
//Ebean.find(Data.class).delete();
Ebean.find(Parent.class).delete();
}
@Test
public void RawSqlParentLoad() {