aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-12 08:30:35 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-12 08:39:04 +0200
commit76a89b62274060452022ddf24a7685ee2f380cb4 (patch)
treeef924603de22efd026f519ab31fd8f5a6ff60f2f /container-search/src/test/java/com/yahoo/search/query
parent7e7ebf7b527be1f163d497a41898e2252d878fe7 (diff)
Replace all usages of Arrays.asList with List.of where possible.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query')
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java4
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/test/ModelTestCase.java6
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/test/RankFeaturesTestCase.java15
4 files changed, 9 insertions, 19 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java
index 20043f23256..58f1fa62fe6 100644
--- a/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileTestCase.java
@@ -20,7 +20,6 @@ import com.yahoo.search.searchchain.Execution;
import com.yahoo.yolean.trace.TraceNode;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -125,7 +124,7 @@ public class QueryProfileTestCase {
far.set("a.far", "a.far", null);
CompiledQueryProfile cbarn = barn.compile(null);
- assertSameObjects(cbarn, "a", Arrays.asList("mormor", "far", "barn"));
+ assertSameObjects(cbarn, "a", List.of("mormor", "far", "barn"));
assertEquals("b.mor", cbarn.get("b.mor"));
assertEquals("b.far", cbarn.get("b.far"));
diff --git a/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java
index 467a0b0845c..266cb4daf67 100644
--- a/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/properties/SubPropertiesTestCase.java
@@ -4,8 +4,8 @@ package com.yahoo.search.query.properties;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
-import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
import com.yahoo.processing.request.properties.PropertyMap;
import org.junit.jupiter.api.Test;
@@ -34,7 +34,7 @@ public class SubPropertiesTestCase {
assertEquals("1", sub.get("e"));
assertEquals(2, sub.get("f"));
assertNull(sub.get("d"));
- assertEquals(new HashSet<>(Arrays.asList("e", "f")), sub.listProperties("").keySet());
+ assertEquals(new HashSet<>(List.of("e", "f")), sub.listProperties("").keySet());
}
}
diff --git a/container-search/src/test/java/com/yahoo/search/query/test/ModelTestCase.java b/container-search/src/test/java/com/yahoo/search/query/test/ModelTestCase.java
index 2cd43257b12..89a62abddcc 100644
--- a/container-search/src/test/java/com/yahoo/search/query/test/ModelTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/test/ModelTestCase.java
@@ -10,8 +10,8 @@ import org.junit.jupiter.api.Test;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import java.util.Arrays;
import java.util.LinkedHashSet;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -91,8 +91,8 @@ public class ModelTestCase {
Model sr = new Model(q);
sr.setRestrict("music, cheese,other");
sr.setSources("cluster1");
- assertEquals(sr.getSources(), new LinkedHashSet<>(Arrays.asList(new String[]{"cluster1"})));
- assertEquals(sr.getRestrict(), new LinkedHashSet<>(Arrays.asList(new String[]{"cheese", "music", "other"})));
+ assertEquals(sr.getSources(), new LinkedHashSet<>(List.of(new String[]{"cluster1"})));
+ assertEquals(sr.getRestrict(), new LinkedHashSet<>(List.of(new String[]{"cheese", "music", "other"})));
}
@Test
diff --git a/container-search/src/test/java/com/yahoo/search/query/test/RankFeaturesTestCase.java b/container-search/src/test/java/com/yahoo/search/query/test/RankFeaturesTestCase.java
index 732fdd7dcbb..7bfbeef4e23 100644
--- a/container-search/src/test/java/com/yahoo/search/query/test/RankFeaturesTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/test/RankFeaturesTestCase.java
@@ -36,7 +36,6 @@ public class RankFeaturesTestCase {
}
@Test
- @SuppressWarnings("deprecation")
void requireThatRankFeaturesUsingDoubleAndDoubleToStringEncodeTheSameWay() {
RankFeatures withDouble = new RankFeatures(new Ranking(new Query()));
withDouble.put("query(myDouble)", 3.8);
@@ -68,20 +67,12 @@ public class RankFeaturesTestCase {
TensorType type = new TensorType.Builder().mapped("x").mapped("y").mapped("z").build();
Tensor tensor1 = Tensor.from(type, "{ {x:a, y:b, z:c}:2.0, {x:a, y:b, z:c2}:3.0 }");
Tensor tensor2 = Tensor.from(type, "{ {x:a, y:b, z:c}:5.0 }");
- assertTensorEncodingAndDecoding(type, Arrays.asList(
+ assertTensorEncodingAndDecoding(type, List.of(
new Entry("query(tensor1)", "tensor1", tensor1),
new Entry("$tensor2", "tensor2", tensor2)));
}
- private static class Entry {
- final String key;
- final String normalizedKey;
- final Tensor tensor;
- Entry(String key, String normalizedKey, Tensor tensor) {
- this.key = key;
- this.normalizedKey = normalizedKey;
- this.tensor = tensor;
- }
+ private record Entry(String key, String normalizedKey, Tensor tensor) {
}
private static void assertTensorEncodingAndDecoding(TensorType type, List<Entry> entries) {
@@ -97,7 +88,7 @@ public class RankFeaturesTestCase {
}
private static void assertTensorEncodingAndDecoding(TensorType type, String key, String normalizedKey, Tensor tensor) {
- assertTensorEncodingAndDecoding(type, Arrays.asList(new Entry(key, normalizedKey, tensor)));
+ assertTensorEncodingAndDecoding(type, List.of(new Entry(key, normalizedKey, tensor)));
}
private static RankProperties createRankPropertiesWithTensors(List<Entry> entries) {