mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
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:
1 parent
bc477c64cb
commit
1fa92efb63
1 file changed
+13
-7
@@ -1,6 +1,7 @@
|
|||||||
package io.ebean.test;
|
package io.ebean.test;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import io.ebean.BaseTestCase;
|
||||||
import io.ebean.DB;
|
import io.ebean.DB;
|
||||||
import org.etest.BSimpleFor;
|
import org.etest.BSimpleFor;
|
||||||
import org.junit.jupiter.api.Test;
|
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;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
|
||||||
public class DbJsonTest {
|
class DbJsonTest extends BaseTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void of() {
|
void of() {
|
||||||
|
|
||||||
DB.find(BSimpleFor.class).delete();
|
DB.find(BSimpleFor.class).delete();
|
||||||
|
|
||||||
@@ -34,14 +35,19 @@ public class DbJsonTest {
|
|||||||
|
|
||||||
final List<BSimpleFor> beans = DB.find(BSimpleFor.class).findList();
|
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)
|
DbJson.of(beans)
|
||||||
//.withPlaceholder("_")
|
.assertContainsResource("/bean/example-list-contains.json");
|
||||||
.replace("id", "whenModified")
|
|
||||||
.assertContentMatches("/bean/example-list.json");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void assertContains_pass() {
|
void assertContains_pass() {
|
||||||
|
|
||||||
BSimpleFor bean = new BSimpleFor("something-contains-me", "YeahNah");
|
BSimpleFor bean = new BSimpleFor("something-contains-me", "YeahNah");
|
||||||
DB.save(bean);
|
DB.save(bean);
|
||||||
@@ -55,7 +61,7 @@ public class DbJsonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void asJson() {
|
void asJson() {
|
||||||
|
|
||||||
BSimpleFor bean = new BSimpleFor("other");
|
BSimpleFor bean = new BSimpleFor("other");
|
||||||
DB.save(bean);
|
DB.save(bean);
|
||||||
|
|||||||
Reference in new issue
Block a user