[TEST] use ParseField instead of plain strings in query tests

This commit is contained in:
javanna 2016-08-08 15:59:51 +02:00 committed by Luca Cavanna
parent 0a98b5e56e
commit 2c44278ce8
5 changed files with 6 additions and 5 deletions

View File

@ -202,7 +202,7 @@ public class MoreLikeThisQueryBuilderTests extends AbstractQueryTestCase<MoreLik
@Override
protected Set<String> 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

View File

@ -87,6 +87,6 @@ public class ScriptQueryBuilderTests extends AbstractQueryTestCase<ScriptQueryBu
protected Set<String> 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());
}
}

View File

@ -108,7 +108,8 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
protected Set<String> 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));
}
/**

View File

@ -171,7 +171,7 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
@Override
protected Set<String> 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() {