Skip to content

Commit

Permalink
SqaleRepoSearchTest: added working exists(..).block().exists(..) example
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Jul 15, 2022
1 parent 8b61b3e commit 5b969a2
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2132,13 +2132,28 @@ public void test607SearchContainerByParentItemCondition() throws SchemaException
.containsExactlyInAnyOrder(1, 2);
}

@Test
public void test608SearchContainerByParentsParent() throws SchemaException {
SearchResultList<AccessCertificationWorkItemType> result = searchContainerTest(
"by parent with specified stage number (using exists)", AccessCertificationWorkItemType.class,
f -> f.exists(T_PARENT)
.block() // block is important, .exists(..).exists(..) fails during filter construction
.exists(T_PARENT)
.item(AccessCertificationCampaignType.F_STAGE_NUMBER).eq(0)
.endBlock());

assertThat(result)
.extracting(a -> a.getStageNumber())
.containsExactlyInAnyOrder(11, 12, 21, 22);
}

@Test
public void test609SearchContainerByParentUnsupportedCases() {
// Unsure what repo would do, but both these cases fail during filter construction in Prism.
assertThatThrownBy(() ->
searchContainerTest(
"by parent with specified stage number (using exists)", AccessCertificationWorkItemType.class,
f -> f.exists(T_PARENT, T_PARENT) // .exists(..).exists(..) fails on check inside R_Filter.exists(...)
f -> f.exists(T_PARENT, T_PARENT)
.item(AccessCertificationCampaignType.F_STAGE_NUMBER).eq(0)))
.isInstanceOf(IllegalStateException.class)
.hasMessageStartingWith("Couldn't find definition for parent for");
Expand Down

0 comments on commit 5b969a2

Please sign in to comment.