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
@@ -4,6 +4,8 @@ import io.ebean.BaseTestCase;
import io.ebean.DuplicateKeyException;
import io.ebean.Ebean;
import io.ebean.annotation.Transactional;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -18,6 +20,11 @@ public class TestInsertDuplicateKey extends BaseTestCase {
private static final Logger log = LoggerFactory.getLogger(TestInsertDuplicateKey.class);
@Before
public void clearDb() {
server().find(Document.class).asDraft().where().contains("title", "UniqueKey").delete();
}
@Test(expected = DuplicateKeyException.class)
public void insert_duplicateKey() {