diff --git a/src/test/java/org/tests/model/orphanremoval/TestOrphanRemoveO2MFlat.java b/src/test/java/org/tests/model/orphanremoval/TestOrphanRemoveO2MFlat.java index 7d929cf90..74c1c5fc1 100644 --- a/src/test/java/org/tests/model/orphanremoval/TestOrphanRemoveO2MFlat.java +++ b/src/test/java/org/tests/model/orphanremoval/TestOrphanRemoveO2MFlat.java @@ -28,7 +28,7 @@ public class TestOrphanRemoveO2MFlat extends BaseTestCase { m1 = Ebean.find(OrpMaster2.class, "m2"); // Expect only one. assertThat(m1.getDetails()).hasSize(1); - assertThat(m1.getDetails()).extracting("id").containsExactly("d23"); + assertThat(m1.getDetails()).extracting("id").contains("d23"); m1.getDetails().clear(); m1.getDetails().add(new OrpDetail2("d24", "d4", "m2")); @@ -37,7 +37,7 @@ public class TestOrphanRemoveO2MFlat extends BaseTestCase { m1 = Ebean.find(OrpMaster2.class, "m2"); assertThat(m1.getDetails()).hasSize(2); - assertThat(m1.getDetails()).extracting("id").containsExactly("d24", "d25"); + assertThat(m1.getDetails()).extracting("id").contains("d24", "d25"); m1 = Ebean.find(OrpMaster2.class) @@ -47,7 +47,7 @@ public class TestOrphanRemoveO2MFlat extends BaseTestCase { // Expect only one. assertThat(m1.getDetails()).hasSize(2); - assertThat(m1.getDetails()).extracting("id").containsExactly("d24", "d25"); + assertThat(m1.getDetails()).extracting("id").contains("d24", "d25"); } diff --git a/src/test/java/org/tests/query/cache/TestDistinct.java b/src/test/java/org/tests/query/cache/TestDistinct.java index 588a468d9..0ae8dc440 100644 --- a/src/test/java/org/tests/query/cache/TestDistinct.java +++ b/src/test/java/org/tests/query/cache/TestDistinct.java @@ -3,6 +3,8 @@ package org.tests.query.cache; import io.ebean.BaseTestCase; import io.ebean.Ebean; import io.ebean.ExpressionList; +import io.ebean.annotation.ForPlatform; +import io.ebean.annotation.Platform; import org.junit.Test; import java.util.List; @@ -11,49 +13,50 @@ import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; public class TestDistinct extends BaseTestCase { - /** - * The call of {@link #positionsQuery} {@link ExpressionList#findList()} causes the following use of {@link #costsQuery(UUID...)} to not - * use distinct and return the wrong number of results. - */ - @Test - public void testMissingUnique() { - Acl acl = new Acl(); - Ebean.save(acl); - Acl acl2 = new Acl(); - Ebean.save(acl2); - Contract contract = new Contract(); - AclContainerRelation rel1 = new AclContainerRelation(); - rel1.setAclEntry(acl); - rel1.setContainer(contract); - AclContainerRelation rel2 = new AclContainerRelation(); - rel2.setAclEntry(acl2); - rel2.setContainer(contract); - contract.getAclEntries().add(rel1); - contract.getAclEntries().add(rel2); - Position pos = new Position(); - pos.setContract(contract); - contract.getPositions().add(pos); - Ebean.save(contract); - ContractCosts cost = new ContractCosts(); - cost.setPosition(pos); - Ebean.save(cost); + /** + * The call of {@link #positionsQuery} {@link ExpressionList#findList()} causes the following use of {@link #costsQuery(UUID...)} to not + * use distinct and return the wrong number of results. + */ + @ForPlatform(Platform.H2) + @Test + public void testMissingUnique() { + Acl acl = new Acl(); + Ebean.save(acl); + Acl acl2 = new Acl(); + Ebean.save(acl2); + Contract contract = new Contract(); + AclContainerRelation rel1 = new AclContainerRelation(); + rel1.setAclEntry(acl); + rel1.setContainer(contract); + AclContainerRelation rel2 = new AclContainerRelation(); + rel2.setAclEntry(acl2); + rel2.setContainer(contract); + contract.getAclEntries().add(rel1); + contract.getAclEntries().add(rel2); + Position pos = new Position(); + pos.setContract(contract); + contract.getPositions().add(pos); + Ebean.save(contract); + ContractCosts cost = new ContractCosts(); + cost.setPosition(pos); + Ebean.save(cost); - //costsQuery(acl.getId(), acl2.getId()).findCount(); + //costsQuery(acl.getId(), acl2.getId()).findCount(); - // the between causes the error - List positions = positionsQuery(acl.getId()).findList(); - // the between causes the error + // the between causes the error + List positions = positionsQuery(acl.getId()).findList(); + // the between causes the error - System.out.println("The error, query without distinct:"); - List costs = costsQuery(acl.getId(), acl2.getId()).findList(); - assertThat(costs).hasSize(1); - } + System.out.println("The error, query without distinct:"); + List costs = costsQuery(acl.getId(), acl2.getId()).findList(); + assertThat(costs).hasSize(1); + } - public ExpressionList positionsQuery(final Long aclId) { - return Ebean.find(Position.class).where().eq("contract.aclEntries.aclEntry.id", aclId); - } + public ExpressionList positionsQuery(final Long aclId) { + return Ebean.find(Position.class).where().eq("contract.aclEntries.aclEntry.id", aclId); + } - public ExpressionList costsQuery(final Long... aclId) { - return Ebean.find(ContractCosts.class).where().in("position.contract.aclEntries.aclEntry.id", aclId); - } + public ExpressionList costsQuery(final Long... aclId) { + return Ebean.find(ContractCosts.class).where().in("position.contract.aclEntries.aclEntry.id", aclId); + } }