Skip to content

Commit 3587d88

Browse files
author
Christoph Büscher
authored
[Tests] Fix failure due to changes exception message (#32036)
Java 11 seems to get more verbose on the ClassCastException we check for in SearchDocumentationIT. This changes the test from asserting the exact exception message to only checking the two classes involved are part of the message. Closes #32029
1 parent ca4c4f7 commit 3587d88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ public void testBuildingSearchQueries() {
295295
}
296296

297297
@SuppressWarnings({ "unused" })
298-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32029")
299298
public void testSearchRequestAggregations() throws IOException {
300299
RestHighLevelClient client = highLevelClient();
301300
{
@@ -338,8 +337,9 @@ public void testSearchRequestAggregations() throws IOException {
338337
Range range = aggregations.get("by_company"); // <1>
339338
// end::search-request-aggregations-get-wrongCast
340339
} catch (ClassCastException ex) {
341-
assertEquals("org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms"
342-
+ " cannot be cast to org.elasticsearch.search.aggregations.bucket.range.Range", ex.getMessage());
340+
String message = ex.getMessage();
341+
assertThat(message, containsString("org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms"));
342+
assertThat(message, containsString("org.elasticsearch.search.aggregations.bucket.range.Range"));
343343
}
344344
assertEquals(3, elasticBucket.getDocCount());
345345
assertEquals(30, avg, 0.0);

0 commit comments

Comments
 (0)