From 2c44278ce814d99a417828605117e80ae0cef2b5 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 8 Aug 2016 15:59:51 +0200 Subject: [PATCH] [TEST] use ParseField instead of plain strings in query tests --- .../elasticsearch/index/query/MoreLikeThisQueryBuilder.java | 2 +- .../index/query/MoreLikeThisQueryBuilderTests.java | 2 +- .../org/elasticsearch/index/query/ScriptQueryBuilderTests.java | 2 +- .../query/functionscore/FunctionScoreQueryBuilderTests.java | 3 ++- .../elasticsearch/percolator/PercolateQueryBuilderTests.java | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java index 7d5d42830bd..8ec0f377ca1 100644 --- a/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java @@ -147,7 +147,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder getObjectsHoldingArbitraryContent() { //doc contains arbitrary content, anything can be added to it and no exception will be thrown - return Collections.singleton("doc"); + return Collections.singleton(MoreLikeThisQueryBuilder.Item.Field.DOC.getPreferredName()); } @Override diff --git a/core/src/test/java/org/elasticsearch/index/query/ScriptQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/ScriptQueryBuilderTests.java index c2a89e32fad..63b8101515e 100644 --- a/core/src/test/java/org/elasticsearch/index/query/ScriptQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/ScriptQueryBuilderTests.java @@ -87,6 +87,6 @@ public class ScriptQueryBuilderTests extends AbstractQueryTestCase getObjectsHoldingArbitraryContent() { //script_score.script.params can contain arbitrary parameters. no error is expected when //adding additional objects within the params object. - return Collections.singleton("params"); + return Collections.singleton(Script.ScriptField.PARAMS.getPreferredName()); } } diff --git a/core/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilderTests.java index b702042a322..c5b31eb6a92 100644 --- a/core/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilderTests.java @@ -108,7 +108,8 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase getObjectsHoldingArbitraryContent() { //script_score.script.params can contain arbitrary parameters. no error is expected when adding additional objects //within the params object. Score functions get parsed in the data nodes, so they are not validated in the coord node. - return new HashSet<>(Arrays.asList("params", "exp", "linear", "gauss")); + return new HashSet<>(Arrays.asList(Script.ScriptField.PARAMS.getPreferredName(), ExponentialDecayFunctionBuilder.NAME, + LinearDecayFunctionBuilder.NAME, GaussDecayFunctionBuilder.NAME)); } /** diff --git a/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolateQueryBuilderTests.java b/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolateQueryBuilderTests.java index 55ef53e696c..abb75b4dbd6 100644 --- a/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolateQueryBuilderTests.java +++ b/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolateQueryBuilderTests.java @@ -171,7 +171,7 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase getObjectsHoldingArbitraryContent() { //document contains arbitrary content, no error expected when an object is added to it - return Collections.singleton("document"); + return Collections.singleton(PercolateQueryBuilder.DOCUMENT_FIELD.getPreferredName()); } public void testRequiredParameters() {