]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 do not reference non existing field in queries
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Tue, 27 Jun 2017 12:06:33 +0000 (14:06 +0200)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 9 Aug 2017 13:09:54 +0000 (15:09 +0200)
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java

index 8e5156aad0c90c03dd98c83ba5b40e62cb5a8dde..e37db705eeb1586583002020172ce51f582f8b4c 100644 (file)
@@ -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()