[TEST] Fix failure due to exception message in java11 (#32321)

Java 11 uses more verbose exceptions messages, causing this assertion
to fail.  Changed the test to be less restrictive and only look
for the classes we care about.
This commit is contained in:
Zachary Tong 2018-07-25 11:34:26 -04:00 committed by GitHub
parent 5a12c63b4e
commit 6cf7588c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -508,10 +508,12 @@ public class RollupResponseTranslationTests extends AggregatorTestCase {
BigArrays bigArrays = new MockBigArrays(new MockPageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService()); BigArrays bigArrays = new MockBigArrays(new MockPageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService());
ScriptService scriptService = mock(ScriptService.class); ScriptService scriptService = mock(ScriptService.class);
InternalAggregation.ReduceContext reduceContext = new InternalAggregation.ReduceContext(bigArrays, scriptService, true); InternalAggregation.ReduceContext reduceContext = new InternalAggregation.ReduceContext(bigArrays, scriptService, true);
Exception e = expectThrows(RuntimeException.class, ClassCastException e = expectThrows(ClassCastException.class,
() -> RollupResponseTranslator.combineResponses(msearch, reduceContext)); () -> RollupResponseTranslator.combineResponses(msearch, reduceContext));
assertThat(e.getMessage(), equalTo("org.elasticsearch.search.aggregations.metrics.geobounds.InternalGeoBounds " + assertThat(e.getMessage(),
"cannot be cast to org.elasticsearch.search.aggregations.InternalMultiBucketAggregation")); containsString("org.elasticsearch.search.aggregations.metrics.geobounds.InternalGeoBounds"));
assertThat(e.getMessage(),
containsString("org.elasticsearch.search.aggregations.InternalMultiBucketAggregation"));
} }
public void testDateHisto() throws IOException { public void testDateHisto() throws IOException {