diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-19 09:36:01 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-19 09:36:01 +0000 |
commit | 613c2a8aa1d14347ae3bdaf9efe92633b5077fa9 (patch) | |
tree | 2206821e80860df9d9f9171d946264a98f0fe782 /container-search/src/test/java/com/yahoo/prelude/querytransform | |
parent | ed9bf1ee31f28295fc920984e0e0cbf492d49e65 (diff) |
Avoid deprecation warnings
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/querytransform')
2 files changed, 18 insertions, 22 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/querytransform/test/LiteralBoostSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/querytransform/test/LiteralBoostSearcherTestCase.java index 9850c80754f..12e756a07ee 100644 --- a/container-search/src/test/java/com/yahoo/prelude/querytransform/test/LiteralBoostSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/querytransform/test/LiteralBoostSearcherTestCase.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.querytransform.test; +import com.google.common.collect.ImmutableList; import com.yahoo.prelude.Index; import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.IndexModel; @@ -11,10 +12,7 @@ import com.yahoo.search.searchchain.Execution; import com.yahoo.search.test.QueryTestCase; import org.junit.Test; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static org.junit.Assert.assertEquals; @@ -87,15 +85,13 @@ public class LiteralBoostSearcherTestCase { Map<String, List<String>> clusters = new LinkedHashMap<>(); clusters.put("cluster1", Arrays.asList("type1", "type2", "type3")); clusters.put("cluster2", Arrays.asList("type4", "type5")); - Map<String, SearchDefinition> searchDefs = new LinkedHashMap<>(); - searchDefs.put("type1", createSearchDefinitionWithFields("type1", true)); - searchDefs.put("type2", createSearchDefinitionWithFields("type2", false)); - searchDefs.put("type3", new SearchDefinition("type3")); - searchDefs.put("type3", new SearchDefinition("type3")); - searchDefs.put("type4", new SearchDefinition("type4")); - searchDefs.put("type5", new SearchDefinition("type5")); - SearchDefinition union = new SearchDefinition("union"); - return new IndexFacts(new IndexModel(clusters, searchDefs, union)); + Collection<SearchDefinition> searchDefs = ImmutableList.of( + createSearchDefinitionWithFields("type1", true), + createSearchDefinitionWithFields("type2", false), + new SearchDefinition("type3"), + new SearchDefinition("type4"), + new SearchDefinition("type5")); + return new IndexFacts(new IndexModel(clusters, searchDefs)); } private SearchDefinition createSearchDefinitionWithFields(String name, boolean literalBoost) { diff --git a/container-search/src/test/java/com/yahoo/prelude/querytransform/test/NormalizingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/querytransform/test/NormalizingSearcherTestCase.java index 77f7f057eea..bf1ab6fc397 100644 --- a/container-search/src/test/java/com/yahoo/prelude/querytransform/test/NormalizingSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/querytransform/test/NormalizingSearcherTestCase.java @@ -4,6 +4,7 @@ package com.yahoo.prelude.querytransform.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import com.google.common.collect.ImmutableList; import com.yahoo.language.Linguistics; import com.yahoo.language.simple.SimpleLinguistics; import com.yahoo.prelude.Index; @@ -24,6 +25,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -129,15 +131,13 @@ public class NormalizingSearcherTestCase { Map<String, List<String>> clusters = new LinkedHashMap<>(); clusters.put("cluster1", Arrays.asList("type1", "type2", "type3")); clusters.put("cluster2", Arrays.asList("type4", "type5")); - Map<String, SearchDefinition> searchDefs = new LinkedHashMap<>(); - searchDefs.put("type1", createSearchDefinitionWithFields("type1", true)); - searchDefs.put("type2", createSearchDefinitionWithFields("type2", false)); - searchDefs.put("type3", new SearchDefinition("type3")); - searchDefs.put("type3", new SearchDefinition("type3")); - searchDefs.put("type4", new SearchDefinition("type4")); - searchDefs.put("type5", new SearchDefinition("type5")); - SearchDefinition union = new SearchDefinition("union"); - return new IndexFacts(new IndexModel(clusters, searchDefs, union)); + Collection<SearchDefinition> searchDefs = ImmutableList.of( + createSearchDefinitionWithFields("type1", true), + createSearchDefinitionWithFields("type2", false), + new SearchDefinition("type3"), + new SearchDefinition("type4"), + new SearchDefinition("type5")); + return new IndexFacts(new IndexModel(clusters, searchDefs)); } private SearchDefinition createSearchDefinitionWithFields(String name, boolean normalize) { |