Skip to content

Commit

Permalink
[Tests] Fix failure due to changes exception message (elastic#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 elastic#32029
  • Loading branch information
Christoph Büscher committed Jul 16, 2018
1 parent d4d2df7 commit 69e61c7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,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 69e61c7

Please sign in to comment.