Yugabyte - Adjust DbJsonTest wrt ordering in content, use JSON assertContainsResource()

Highlights that the DbJson assertContains() asserts are better longer term approach (over content matching asserts)
This commit is contained in:
Rob Bygrave committed 2022-02-01 11:55:15 +13:00
1 parent bc477c64cb
commit 1fa92efb63
1 file changed
+13 -7
@@ -1,6 +1,7 @@
package io.ebean.test;
import com.fasterxml.jackson.databind.JsonNode;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import org.etest.BSimpleFor;
import org.junit.jupiter.api.Test;
@@ -11,10 +12,10 @@ import static io.ebean.test.DbJson.readResource;
import static org.assertj.core.api.Assertions.assertThat;
public class DbJsonTest {
class DbJsonTest extends BaseTestCase {
@Test
public void of() {
void of() {
DB.find(BSimpleFor.class).delete();
@@ -34,14 +35,19 @@ public class DbJsonTest {
final List<BSimpleFor> beans = DB.find(BSimpleFor.class).findList();
if (isH2() || isPostgres()) {
DbJson.of(beans)
//.withPlaceholder("_")
.replace("id", "whenModified")
.assertContentMatches("/bean/example-list-match.json");
}
DbJson.of(beans)
//.withPlaceholder("_")
.replace("id", "whenModified")
.assertContentMatches("/bean/example-list.json");
.assertContainsResource("/bean/example-list-contains.json");
}
@Test
public void assertContains_pass() {
void assertContains_pass() {
BSimpleFor bean = new BSimpleFor("something-contains-me", "YeahNah");
DB.save(bean);
@@ -55,7 +61,7 @@ public class DbJsonTest {
}
@Test
public void asJson() {
void asJson() {
BSimpleFor bean = new BSimpleFor("other");
DB.save(bean);