FIX: TestHistoryInsert / TestNewTypes failing nondeterministic

This commit is contained in:
Roland Praml
2016-08-30 09:14:22 +02:00
parent adfe5f0305
commit 4f3b461f8e
2 changed files with 4 additions and 4 deletions
@@ -17,7 +17,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class TestHistoryInsert extends BaseTestCase {
@Test
public void test() {
public void test() throws InterruptedException {
SpiEbeanServer defaultServer = (SpiEbeanServer)Ebean.getDefaultServer();
if (!"h2".equals(defaultServer.getDatabasePlatform().getName())) {
@@ -41,6 +41,7 @@ public class TestHistoryInsert extends BaseTestCase {
assertThat(versions).hasSize(1);
user.setName("Jim v2");
Thread.sleep(10); // wait, to ensure that whenModified differs
Ebean.save(user);
history = fetchHistory(user);
@@ -19,8 +19,7 @@ public class TestNewTypes extends BaseTestCase {
private static final String TEMP_PATH = new File("/tmp").getAbsolutePath();
@Test
public void testInsertUpdate() throws IOException {
public void testInsertUpdate() throws IOException, InterruptedException {
SomeNewTypesBean bean = new SomeNewTypesBean();
bean.setLocalDate(LocalDate.now());
bean.setLocalDateTime(LocalDateTime.now());
@@ -42,7 +41,7 @@ public class TestNewTypes extends BaseTestCase {
bean.setMonth(Month.SEPTEMBER);
Ebean.save(bean);
Thread.sleep(10); // wait, to ensure that instant < Instant.now()
List<SomeNewTypesBean> list = Ebean.find(SomeNewTypesBean.class).where().lt("instant", Instant.now()).findList();
assertTrue(!list.isEmpty());