From 329eaaea65963ba60ae274a0c5bb853232a47b3b Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 8 Aug 2016 19:09:43 +0200 Subject: [PATCH] [TEST] expand AbstractQueryTestCase#testQueryWrappedInArray to run against query alternate versions --- .../org/elasticsearch/test/AbstractQueryTestCase.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java index d5c4752da5e..a884f45359d 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java @@ -339,10 +339,17 @@ public abstract class AbstractQueryTestCase> * Test that wraps the randomly generated query into an array as follows: { "query_name" : [{}]} * This causes unexpected situations in parser code that may not be handled properly. */ - public void testQueryWrappedInArray() throws IOException { + public final void testQueryWrappedInArray() throws IOException { QB queryBuilder = createTestQueryBuilder(); - String validQuery = queryBuilder.toString(); String queryName = queryBuilder.getName(); + String validQuery = queryBuilder.toString(); + queryWrappedInArrayTest(queryName, validQuery); + for (String query : getAlternateVersions().keySet()) { + queryWrappedInArrayTest(queryName, query); + } + } + + private void queryWrappedInArrayTest(String queryName, String validQuery) throws IOException { int i = validQuery.indexOf("\"" + queryName + "\""); assertThat(i, greaterThan(0));