Skip to content

Commit

Permalink
Fix tests asserting error message
Browse files Browse the repository at this point in the history
  • Loading branch information
albertzaharovits committed Jun 10, 2024
1 parent 6eebc4b commit f7fd4e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public void translateFieldSortBuilders(
final Consumer<String> fieldNameVisitor = visitor != null ? visitor : ignored -> {};
fieldSortBuilders.forEach(fieldSortBuilder -> {
if (fieldSortBuilder.getNestedSort() != null) {
throw new IllegalArgumentException("nested sorting is not supported for querying");
throw new IllegalArgumentException("nested sorting is not currently supported in this context");
}
if (FieldSortBuilder.DOC_FIELD_NAME.equals(fieldSortBuilder.getFieldName())) {
searchSourceBuilder.sort(fieldSortBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testNestedSortingIsNotAllowed() {
ignored -> {}
)
);
assertThat(e.getMessage(), equalTo("nested sorting is not supported for API Key query"));
assertThat(e.getMessage(), equalTo("nested sorting is not currently supported in this context"));
}

private FieldSortBuilder randomFieldSortBuilderWithName(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ public void testTermsLookupIsNotAllowed() {
IllegalArgumentException.class,
() -> ApiKeyBoolQueryBuilder.build(q1, ignored -> {}, authentication)
);
assertThat(e1.getMessage(), containsString("terms query with terms lookup is not supported for API Key query"));
assertThat(e1.getMessage(), containsString("terms query with terms lookup is not currently supported in this context"));
}

public void testRangeQueryWithRelationIsNotAllowed() {
Expand All @@ -688,7 +688,7 @@ public void testRangeQueryWithRelationIsNotAllowed() {
IllegalArgumentException.class,
() -> ApiKeyBoolQueryBuilder.build(q1, ignored -> {}, authentication)
);
assertThat(e1.getMessage(), containsString("range query with relation is not supported for API Key query"));
assertThat(e1.getMessage(), containsString("range query with relation is not currently supported in this context"));
}

public void testDisallowedQueryTypes() {
Expand Down Expand Up @@ -734,7 +734,7 @@ public void testDisallowedQueryTypes() {
IllegalArgumentException.class,
() -> ApiKeyBoolQueryBuilder.build(q1, ignored -> {}, authentication)
);
assertThat(e1.getMessage(), containsString("Query type [" + q1.getName() + "] is not supported for API Key query"));
assertThat(e1.getMessage(), containsString("Query type [" + q1.getName() + "] is not currently supported in this context"));

// also wrapped in a boolean query
{
Expand All @@ -756,7 +756,7 @@ public void testDisallowedQueryTypes() {
IllegalArgumentException.class,
() -> ApiKeyBoolQueryBuilder.build(q2, ignored -> {}, authentication)
);
assertThat(e2.getMessage(), containsString("Query type [" + q1.getName() + "] is not supported for API Key query"));
assertThat(e2.getMessage(), containsString("Query type [" + q1.getName() + "] is not currently supported in this context"));
}
}

Expand Down

0 comments on commit f7fd4e8

Please sign in to comment.