Skip to content

Commit

Permalink
[Tests] Fix failure due to changes exception message (#32036)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christoph Büscher committed Jul 16, 2018
1 parent ca4c4f7 commit 3587d88
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -295,7 +295,6 @@ public void testBuildingSearchQueries() {
}

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

0 comments on commit 3587d88

Please sign in to comment.