mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Update tests change AssertJ StrictAssertions to Assertions
This commit is contained in:
@@ -8,7 +8,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestInEmpty extends BaseTestCase {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.tests.model.basic.Contact;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
import org.tests.model.converstation.Group;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestDeleteWithoutOptimisticLocking extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -4,11 +4,10 @@ import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Query;
|
||||
import org.tests.model.draftable.Doc;
|
||||
import org.tests.model.draftable.Link;
|
||||
import org.assertj.core.api.StrictAssertions;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.draftable.Doc;
|
||||
import org.tests.model.draftable.Link;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.Timestamp;
|
||||
@@ -48,10 +47,10 @@ public class DocLinkTest extends BaseTestCase {
|
||||
public void testUpdate_whenNotPublished() {
|
||||
|
||||
Link link1 = new Link("update");
|
||||
StrictAssertions.assertThat(link1.isDraft()).isFalse();
|
||||
assertThat(link1.isDraft()).isFalse();
|
||||
|
||||
link1.save();
|
||||
StrictAssertions.assertThat(link1.isDraft()).isTrue();
|
||||
assertThat(link1.isDraft()).isTrue();
|
||||
|
||||
// perform stateless update
|
||||
Link linkUpdate = new Link();
|
||||
@@ -71,10 +70,10 @@ public class DocLinkTest extends BaseTestCase {
|
||||
public void testDelete_whenNotPublished() {
|
||||
|
||||
Link link1 = new Link("Ld1");
|
||||
StrictAssertions.assertThat(link1.isDraft()).isFalse();
|
||||
assertThat(link1.isDraft()).isFalse();
|
||||
|
||||
link1.save();
|
||||
StrictAssertions.assertThat(link1.isDraft()).isTrue();
|
||||
assertThat(link1.isDraft()).isTrue();
|
||||
|
||||
link1.setComment("some change");
|
||||
link1.save();
|
||||
@@ -120,15 +119,15 @@ public class DocLinkTest extends BaseTestCase {
|
||||
server.publish(Link.class, link1.getId());
|
||||
|
||||
link1 = Ebean.find(Link.class).setId(link1.getId()).asDraft().findOne();
|
||||
StrictAssertions.assertThat(link1.isDraft()).isTrue();
|
||||
assertThat(link1.isDraft()).isTrue();
|
||||
|
||||
// this is a soft delete (no automatic publish here, only updates draft)
|
||||
link1.delete();
|
||||
|
||||
Link live = Ebean.find(Link.class).setId(link1.getId()).findOne();
|
||||
assertThat(live).isNotNull();
|
||||
StrictAssertions.assertThat(live.isDraft()).isFalse();
|
||||
StrictAssertions.assertThat(live.isDeleted()).isFalse(); // soft delete state not published yet
|
||||
assertThat(live.isDraft()).isFalse();
|
||||
assertThat(live.isDeleted()).isFalse(); // soft delete state not published yet
|
||||
|
||||
// this is a permanent delete (effectively has automatic publish)
|
||||
server.deletePermanent(link1);
|
||||
@@ -169,19 +168,18 @@ public class DocLinkTest extends BaseTestCase {
|
||||
link1.save();
|
||||
|
||||
Link draft1 = Ebean.find(Link.class).setId(link1.getId()).asDraft().findOne();
|
||||
StrictAssertions.assertThat(draft1.isDirty()).isTrue();
|
||||
assertThat(draft1.isDirty()).isTrue();
|
||||
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
Link linkLive = server.publish(Link.class, link1.getId(), null);
|
||||
StrictAssertions.assertThat(linkLive.getComment()).isEqualTo(comment);
|
||||
StrictAssertions.assertThat(linkLive.getWhenPublish()).isEqualToIgnoringMillis(when);
|
||||
assertThat(linkLive.getComment()).isEqualTo(comment);
|
||||
assertThat(linkLive.getWhenPublish()).isEqualToIgnoringMillis(when);
|
||||
|
||||
Link draft1b = Ebean.find(Link.class).setId(link1.getId()).asDraft().findOne();
|
||||
StrictAssertions.assertThat(draft1b.isDirty()).isFalse();
|
||||
StrictAssertions.assertThat(draft1b.getComment()).isNull();
|
||||
StrictAssertions.assertThat(draft1b.getWhenPublish()).isNull();
|
||||
|
||||
assertThat(draft1b.isDirty()).isFalse();
|
||||
assertThat(draft1b.getComment()).isNull();
|
||||
assertThat(draft1b.getWhenPublish()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -245,7 +243,7 @@ public class DocLinkTest extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getDefaultServer();
|
||||
|
||||
Link live = server.publish(Link.class, link1.getId(), null);
|
||||
StrictAssertions.assertThat(live.isDraft()).isFalse();
|
||||
assertThat(live.isDraft()).isFalse();
|
||||
|
||||
Link draftLink = Ebean.find(Link.class)
|
||||
.setId(link1.getId())
|
||||
@@ -262,8 +260,7 @@ public class DocLinkTest extends BaseTestCase {
|
||||
.asDraft()
|
||||
.findOne();
|
||||
|
||||
StrictAssertions.assertThat(draftLink.getLocation()).isEqualTo("firstLocation");
|
||||
|
||||
assertThat(draftLink.getLocation()).isEqualTo("firstLocation");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -291,9 +288,8 @@ public class DocLinkTest extends BaseTestCase {
|
||||
List<Link> links = server.draftRestore(query);
|
||||
|
||||
assertThat(links).hasSize(1);
|
||||
StrictAssertions.assertThat(links.get(0).getLocation()).isEqualTo("firstLocation");
|
||||
StrictAssertions.assertThat(links.get(0).isDirty()).isEqualTo(false);
|
||||
StrictAssertions.assertThat(links.get(0).getComment()).isNull();
|
||||
|
||||
assertThat(links.get(0).getLocation()).isEqualTo("firstLocation");
|
||||
assertThat(links.get(0).isDirty()).isEqualTo(false);
|
||||
assertThat(links.get(0).getComment()).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ package org.tests.draftable;
|
||||
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.EbeanServer;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.draftable.Document;
|
||||
import org.tests.model.draftable.DocumentMedia;
|
||||
import org.tests.model.draftable.Organisation;
|
||||
import org.assertj.core.api.StrictAssertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -99,8 +98,8 @@ public class OrganisationTest {
|
||||
// publish will perform an insert, update and delete on child DocumentMedia
|
||||
// during the publish below with media1 being deleted
|
||||
Document liveBean = server.publish(Document.class, doc.getId(), null);
|
||||
StrictAssertions.assertThat(liveBean.getBody()).isEqualTo("Body2");
|
||||
StrictAssertions.assertThat(liveBean.getMedia().size()).isEqualTo(2);
|
||||
assertThat(liveBean.getBody()).isEqualTo("Body2");
|
||||
assertThat(liveBean.getMedia().size()).isEqualTo(2);
|
||||
assertThat(liveBean.getMedia()).extracting("name").contains("media2", "media3");
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import org.tests.model.EGenProps;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestGeneratedProperties extends BaseTestCase {
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class TestInheritInsert extends BaseTestCase {
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.tests.model.basic.cache.CInhOne;
|
||||
import org.tests.model.basic.cache.CInhRoot;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestInheritanceCache extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestJsonExcludeTransientEmptyList {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestModelAJson {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestFindOneOrEmpty extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.Query;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestQueryOrderById extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.tests.model.basic.VehicleDriver;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestSubQuery extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.ebean.Query;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.converstation.Conversation;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestFetchPreference extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestOrderReportTotal extends BaseTestCase {
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.ebean.Ebean;
|
||||
import org.tests.model.softdelete.ESoftDelMid;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestSoftDeleteOptionalRelationship extends BaseTestCase {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.junit.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class TestExecuteComplete extends BaseTestCase {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestHstore extends BaseTestCase {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TestSqlUpdateUpsert extends BaseTestCase {
|
||||
assertThat(found2.getId()).isEqualTo(key);
|
||||
assertThat(found2.getEmail()).isEqualTo(email);
|
||||
assertThat(found2.isOnlineStatus()).isFalse();
|
||||
assertThat(found2.getWhenUpdated()).isGreaterThan(found.getWhenUpdated()); // otherwise this test fails on my machine
|
||||
assertThat(found2.getWhenUpdated()).isAfter(found.getWhenUpdated()); // otherwise this test fails on my machine
|
||||
}
|
||||
|
||||
@ForPlatform(Platform.POSTGRES)
|
||||
@@ -84,7 +84,7 @@ public class TestSqlUpdateUpsert extends BaseTestCase {
|
||||
assertThat(found2.getId()).isEqualTo(key);
|
||||
assertThat(found2.getEmail()).isEqualTo("foo@one.com");
|
||||
assertThat(found2.isOnlineStatus()).isFalse();
|
||||
assertThat(found2.getWhenUpdated()).isGreaterThan(found.getWhenUpdated());
|
||||
assertThat(found2.getWhenUpdated()).isAfter(found.getWhenUpdated());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user