Skip to content

Commit f0f9b15

Browse files
committed
assert on wrapped exception as well
1 parent ec59f97 commit f0f9b15

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
4343
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
44+
import static org.hamcrest.CoreMatchers.containsString;
4445
import static org.hamcrest.CoreMatchers.equalTo;
4546
import static org.hamcrest.CoreMatchers.instanceOf;
4647

@@ -291,6 +292,9 @@ public void testUnknownQueryName() throws IOException {
291292

292293
XContentParseException ex = expectThrows(XContentParseException.class, () -> parseQuery(query));
293294
assertEquals("[1:41] [bool] failed to parse field [must]", ex.getMessage());
295+
Throwable e = ex.getCause();
296+
assertThat(e.getMessage(), containsString("unknown query [unknown_query]"));
297+
294298
}
295299

296300
public void testRewrite() throws IOException {

0 commit comments

Comments
 (0)