From e4999c7a0052963405bb2c63df926950bc2ca2cc Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Tue, 27 Jun 2017 14:06:33 +0200 Subject: [PATCH] SONAR-8798 do not reference non existing field in queries --- .../component/index/ComponentIndexFeatureFavoriteTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java index 8e5156aad0c..e37db705eeb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java @@ -30,6 +30,7 @@ import static java.util.Collections.singletonList; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.sonar.api.resources.Qualifiers.PROJECT; +import static org.sonar.server.component.index.ComponentIndexDefinition.FIELD_KEY; public class ComponentIndexFeatureFavoriteTest extends ComponentIndexTest { @@ -60,7 +61,7 @@ public class ComponentIndexFeatureFavoriteTest extends ComponentIndexTest { @Test public void irrelevant_favorites_are_not_returned() { - features.set(q -> termQuery("non-existing-field", "non-existing-value"), ComponentTextSearchFeatureRepertoire.FAVORITE); + features.set(q -> termQuery(FIELD_KEY, "non-existing-value"), ComponentTextSearchFeatureRepertoire.FAVORITE); ComponentDto project1 = indexProject("foo", "foo"); ComponentIndexQuery query1 = ComponentIndexQuery.builder() -- 2.39.5