aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo')
-rw-r--r--container-search/src/test/java/com/yahoo/container/core/config/testutil/MockOsgiWrapper.java6
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java4
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/query/parser/test/TokenizerTestCase.java12
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/query/textualrepresentation/test/TextualQueryRepresentationTestCase.java10
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java15
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/LoadBalancerTest.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/rpc/ProtobufSerializationTest.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/federation/FederationSearcherTest.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java5
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java6
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java21
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java43
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java5
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java4
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java11
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java27
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java7
-rw-r--r--container-search/src/test/java/com/yahoo/search/pagetemplates/test/PageTemplateSearcherTestCase.java10
-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/properties/test/PropertyMapTestCase.java5
-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
-rw-r--r--container-search/src/test/java/com/yahoo/search/ranking/GlobalPhaseRerankHitsImplTest.java16
-rw-r--r--container-search/src/test/java/com/yahoo/search/result/test/FillingTestCase.java7
-rw-r--r--container-search/src/test/java/com/yahoo/search/result/test/HitGroupTestCase.java13
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionTestCase.java7
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java4
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/test/SearchChainTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/test/SimpleSearchChain.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchchain/test/TraceTestCase.java3
-rw-r--r--container-search/src/test/java/com/yahoo/search/searchers/test/MockMetric.java78
-rw-r--r--container-search/src/test/java/com/yahoo/search/yql/VespaSerializerTestCase.java5
-rw-r--r--container-search/src/test/java/com/yahoo/search/yql/YqlFieldAndSourceTestCase.java7
-rw-r--r--container-search/src/test/java/com/yahoo/text/interpretation/test/AnnotationTestCase.java7
41 files changed, 148 insertions, 256 deletions
diff --git a/container-search/src/test/java/com/yahoo/container/core/config/testutil/MockOsgiWrapper.java b/container-search/src/test/java/com/yahoo/container/core/config/testutil/MockOsgiWrapper.java
index 150a2a5d78a..ebe4ccdd2ba 100644
--- a/container-search/src/test/java/com/yahoo/container/core/config/testutil/MockOsgiWrapper.java
+++ b/container-search/src/test/java/com/yahoo/container/core/config/testutil/MockOsgiWrapper.java
@@ -8,8 +8,6 @@ import org.osgi.framework.Bundle;
import java.util.Collection;
import java.util.List;
-import static java.util.Collections.emptyList;
-
/**
* @author gjoranv
*/
@@ -22,7 +20,7 @@ public class MockOsgiWrapper implements OsgiWrapper {
@Override
public List<Bundle> getCurrentBundles() {
- return emptyList();
+ return List.of();
}
@Override
@@ -32,7 +30,7 @@ public class MockOsgiWrapper implements OsgiWrapper {
@Override
public List<Bundle> install(String absolutePath) {
- return emptyList();
+ return List.of();
}
@Override
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
index 58427bee30a..3cefeeabdcf 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
@@ -20,7 +20,6 @@ import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -98,7 +97,7 @@ public class IndexedBackendTestCase {
var backend = new IndexedBackend(new ClusterParams(CLUSTER_PARAMS.getSearcherName(), CLUSTER_PARAMS.getServerId(),
CLUSTER_PARAMS.getDefaultSummary(), CLUSTER_PARAMS.getDocumentdbInfoConfig(),
new SchemaInfo(List.of(schema.build()), List.of())),
- MockDispatcher.create(Collections.singletonList(new Node(CLUSTER, 0, "host0", 0))));
+ MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))));
Query q = new Query("?query=foo");
Result result = doSearch(backend, q, 0, 10);
assertFalse(backend.summaryNeedsQuery(q));
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java b/container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java
index f8fe0c92020..d2d5d124297 100644
--- a/container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/query/ItemsCommonStuffTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.prelude.query;
import static org.junit.jupiter.api.Assertions.*;
import java.nio.ByteBuffer;
-import java.util.Arrays;
+import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.regex.PatternSyntaxException;
@@ -211,7 +211,7 @@ public class ItemsCommonStuffTestCase {
w.setConnectivity(v, 1.0);
String expected = "puppy";
String expected2 = "kvalp";
- EquivItem e = new EquivItem(w, Arrays.asList(expected, expected2));
+ EquivItem e = new EquivItem(w, List.of(expected, expected2));
assertEquals(1.0, e.getConnectivity(), 1e-9);
assertSame(v, e.getConnectedItem());
assertEquals(expected, ((WordItem) e.getItem(1)).getWord());
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/TokenizerTestCase.java b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/TokenizerTestCase.java
index fbede4613da..0b12cf99396 100644
--- a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/TokenizerTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/TokenizerTestCase.java
@@ -13,8 +13,8 @@ import com.yahoo.prelude.query.parser.Tokenizer;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import java.util.Set;
import static com.yahoo.prelude.query.parser.Token.Kind.COLON;
import static com.yahoo.prelude.query.parser.Token.Kind.COMMA;
@@ -283,7 +283,7 @@ public class TokenizerTestCase {
sd.addIndex(index2);
IndexFacts facts = new IndexFacts(new IndexModel(sd));
- IndexFacts.Session session = facts.newSession(Collections.emptySet(), Collections.emptySet());
+ IndexFacts.Session session = facts.newSession(Set.of(), Set.of());
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:/,%#%&+-+ ) testexact2:ho_/&%&/()/aa*::*& b:c", "default", session);
// tokenizer.print();
@@ -328,7 +328,7 @@ public class TokenizerTestCase {
IndexFacts facts = new IndexFacts(new IndexModel(sd));
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
- IndexFacts.Session session = facts.newSession(Collections.emptySet(), Collections.emptySet());
+ IndexFacts.Session session = facts.newSession(Set.of(), Set.of());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:/,%#%&+-+ ) testexact2:ho_/&%&/()/aa*::*&", session);
assertEquals(new Token(WORD, "normal"), tokens.get(0));
assertEquals(new Token(SPACE, " "), tokens.get(1));
@@ -365,7 +365,7 @@ public class TokenizerTestCase {
IndexFacts facts = new IndexFacts(new IndexModel(sd));
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
- IndexFacts.Session session = facts.newSession(Collections.emptySet(), Collections.emptySet());
+ IndexFacts.Session session = facts.newSession(Set.of(), Set.of());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:/,%#%&+-+ ) testexact2:ho_/&%&/()/aa*::*", session);
assertEquals(new Token(WORD, "normal"), tokens.get(0));
assertEquals(new Token(SPACE, " "), tokens.get(1));
@@ -402,7 +402,7 @@ public class TokenizerTestCase {
IndexFacts facts = new IndexFacts(new IndexModel(sd));
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
- IndexFacts.Session session = facts.newSession(Collections.emptySet(), Collections.emptySet());
+ IndexFacts.Session session = facts.newSession(Set.of(), Set.of());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:!/%#%&+-+ ) testexact2:ho_/&%&/()/aa*::*&b:", session);
assertEquals(new Token(WORD, "normal"), tokens.get(0));
assertEquals(new Token(SPACE, " "), tokens.get(1));
@@ -439,7 +439,7 @@ public class TokenizerTestCase {
sd.addIndex(index2);
IndexFacts indexFacts = new IndexFacts(new IndexModel(sd));
- IndexFacts.Session facts = indexFacts.newSession(Collections.emptySet(), Collections.emptySet());
+ IndexFacts.Session facts = indexFacts.newSession(Set.of(), Set.of());
Tokenizer tokenizer = new Tokenizer(new SimpleLinguistics());
List<?> tokens = tokenizer.tokenize("normal a:b (normal testexact1:foo) testexact2:bar", facts);
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/textualrepresentation/test/TextualQueryRepresentationTestCase.java b/container-search/src/test/java/com/yahoo/prelude/query/textualrepresentation/test/TextualQueryRepresentationTestCase.java
index f5dc598485a..475b8ddc02a 100644
--- a/container-search/src/test/java/com/yahoo/prelude/query/textualrepresentation/test/TextualQueryRepresentationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/query/textualrepresentation/test/TextualQueryRepresentationTestCase.java
@@ -5,9 +5,9 @@ import java.io.BufferedReader;
import java.io.FileReader;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import com.yahoo.prelude.query.Item;
@@ -29,7 +29,7 @@ public class TextualQueryRepresentationTestCase {
example;
}
- private class MockItem extends Item {
+ private static class MockItem extends Item {
private final String name;
@Override
@@ -71,7 +71,7 @@ public class TextualQueryRepresentationTestCase {
Map<Integer, Object> exampleMap = new HashMap<>();
exampleMap.put(1, "one");
exampleMap.put(2, "two");
- exampleMap.put(3, Arrays.asList('x', 'y', 'z'));
+ exampleMap.put(3, List.of('x', 'y', 'z'));
discloser.addProperty("01", null);
discloser.addProperty("02", "a string.");
@@ -79,9 +79,9 @@ public class TextualQueryRepresentationTestCase {
discloser.addProperty("04", true);
discloser.addProperty("05", ExampleEnum.example);
discloser.addProperty("06", new int[]{1, 2, 3});
- discloser.addProperty("07", Arrays.asList('x', 'y', 'z'));
+ discloser.addProperty("07", List.of('x', 'y', 'z'));
discloser.addProperty("08", new ArrayList());
- discloser.addProperty("09", new HashSet(Arrays.asList(1, 2, 3)));
+ discloser.addProperty("09", new HashSet(List.of(1, 2, 3)));
discloser.addProperty("10", exampleMap);
discloser.setValue("example-value: \"12\"");
diff --git a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java
index 4ce1cd5a10d..4b7c7e592cf 100644
--- a/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/searcher/test/BlendingSearcherTestCase.java
@@ -1,7 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.searcher.test;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -286,7 +285,7 @@ public class BlendingSearcherTestCase {
assertEquals(1, cr.getConcreteHitCount());
com.yahoo.search.result.ErrorHit errorHit = cr.hits().getErrorHit();
Iterator errorIterator = errorHit.errorIterator();
- List<String> errorList = Arrays.asList("Source 'a': No backends in service. Try later",
+ List<String> errorList = List.of("Source 'a': No backends in service. Try later",
"Source 'b': 2: Request too large");
String a = errorIterator.next().toString();
assertTrue(errorList.contains(a), a);
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
index 8ced7d3895e..152056dfb72 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
@@ -28,11 +28,10 @@ import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.StreamSupport;
@@ -203,10 +202,10 @@ public class InterleavedSearchInvokerTest {
}
private static final double DELTA = 0.000000000001;
- private static final List<Double> A5 = Arrays.asList(11.0,8.5,7.5,3.0,2.0);
- private static final List<Double> B5 = Arrays.asList(9.0,8.0,7.0,6.0,1.0);
- private static final List<Double> A5Aux = Arrays.asList(-1.0,11.0,8.5,7.5,-7.0,3.0,2.0);
- private static final List<Double> B5Aux = Arrays.asList(9.0,8.0,-3.0,7.0,6.0,1.0, -1.0);
+ private static final List<Double> A5 = List.of(11.0,8.5,7.5,3.0,2.0);
+ private static final List<Double> B5 = List.of(9.0,8.0,7.0,6.0,1.0);
+ private static final List<Double> A5Aux = List.of(-1.0,11.0,8.5,7.5,-7.0,3.0,2.0);
+ private static final List<Double> B5Aux = List.of(9.0,8.0,-3.0,7.0,6.0,1.0, -1.0);
private void validateThatTopKProbabilityOverrideTakesEffect(Double topKProbability, int expectedK, Group group) throws IOException {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(A5, B5, group)) {
@@ -356,7 +355,7 @@ public class InterleavedSearchInvokerTest {
.addAggregationResult(new MinAggregationResult().setMin(new IntegerResultNode(6)).setTag(3))));
invokers.add(new MockInvoker(0).setHits(List.of(new GroupingListHit(List.of(grouping2)))));
- try (InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, new Group(0, List.of()), Collections.emptySet())) {
+ try (InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, new Group(0, List.of()), Set.of())) {
invoker.responseAvailable(invokers.get(0));
invoker.responseAvailable(invokers.get(1));
Result result = invoker.search(query);
@@ -373,7 +372,7 @@ public class InterleavedSearchInvokerTest {
List<SearchInvoker> invokers = new ArrayList<>();
invokers.add(createInvoker(a, 0));
invokers.add(createInvoker(b, 1));
- InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, group, Collections.emptySet());
+ InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, group, Set.of());
invoker.responseAvailable(invokers.get(0));
invoker.responseAvailable(invokers.get(1));
return invoker;
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/LoadBalancerTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/LoadBalancerTest.java
index 8b6b3c4d13a..3053fe7d730 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/LoadBalancerTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/LoadBalancerTest.java
@@ -10,7 +10,6 @@ import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.time.Instant;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -238,7 +237,7 @@ public class LoadBalancerTest {
}
private GroupStatus newGroupStatus(int id) {
- Group dummyGroup = new Group(id, Collections.emptyList()) {
+ Group dummyGroup = new Group(id, List.of()) {
@Override
public boolean hasSufficientCoverage() {
return true;
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/rpc/ProtobufSerializationTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/rpc/ProtobufSerializationTest.java
index be8f99a4ef4..6459d67480d 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/rpc/ProtobufSerializationTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/rpc/ProtobufSerializationTest.java
@@ -14,7 +14,6 @@ import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.search.query.profile.config.QueryProfileXMLReader;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -66,7 +65,7 @@ public class ProtobufSerializationTest {
builder.setTimeout(0);
var hit = new FastHit();
hit.setGlobalId(new GlobalId(IdString.createIdString("id:ns:type::id")).getRawId());
- var bytes = ProtobufSerialization.serializeDocsumRequest(builder, Collections.singletonList(hit));
+ var bytes = ProtobufSerialization.serializeDocsumRequest(builder, List.of(hit));
assertEquals(56, bytes.length);
}
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
index 5223eb0b06b..1b36c2b8151 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
@@ -12,7 +12,6 @@ import com.yahoo.search.result.ErrorMessage;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -46,7 +45,7 @@ public class SearchClusterTest {
List<AtomicInteger> pingCounts;
State(String clusterId, int nodesPergroup, String ... nodeNames) {
- this(clusterId, nodesPergroup, Arrays.asList(nodeNames));
+ this(clusterId, nodesPergroup, List.of(nodeNames));
}
State(String clusterId, int nodesPerGroup, List<String> nodeNames) {
diff --git a/container-search/src/test/java/com/yahoo/search/federation/FederationSearcherTest.java b/container-search/src/test/java/com/yahoo/search/federation/FederationSearcherTest.java
index 4d3e3c18e0b..1ac6dcbe1b6 100644
--- a/container-search/src/test/java/com/yahoo/search/federation/FederationSearcherTest.java
+++ b/container-search/src/test/java/com/yahoo/search/federation/FederationSearcherTest.java
@@ -23,7 +23,6 @@ import com.yahoo.search.searchchain.model.federation.FederationOptions;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -339,7 +338,7 @@ public class FederationSearcherTest {
@Override
public Collection<FederationTarget<String>> getTargets(Query query, ChainRegistry<Searcher> searcherChainRegistry) {
- return Arrays.asList(createTarget(1), createTarget(2));
+ return List.of(createTarget(1), createTarget(2));
}
private FederationTarget<String> createTarget(int number) {
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java
index 76a1a71f6ed..540ecfa6e12 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java
@@ -9,7 +9,6 @@ import com.yahoo.search.searchchain.Execution;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
import java.util.List;
import java.util.TimeZone;
@@ -22,12 +21,12 @@ public class GroupingQueryParserTestCase {
@Test
void requireThatNoRequestIsSkipped() {
- assertEquals(Collections.emptyList(), executeQuery(null, null, null));
+ assertEquals(List.of(), executeQuery(null, null, null));
}
@Test
void requireThatEmptyRequestIsSkipped() {
- assertEquals(Collections.emptyList(), executeQuery("", null, null));
+ assertEquals(List.of(), executeQuery("", null, null));
}
@Test
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java
index 97eed95946f..3af2614b6fb 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java
@@ -11,8 +11,6 @@ import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -34,7 +32,7 @@ public class GroupingRequestTestCase {
}
};
req.continuations().add(foo);
- assertEquals(Arrays.asList(foo), req.continuations());
+ assertEquals(List.of(foo), req.continuations());
req.continuations().clear();
assertTrue(req.continuations().isEmpty());
@@ -121,7 +119,7 @@ public class GroupingRequestTestCase {
@Test
void requireThatGetRequestsReturnsAllRequests() {
Query query = new Query();
- assertEquals(Collections.emptyList(), query.getSelect().getGrouping());
+ assertEquals(List.of(), query.getSelect().getGrouping());
GroupingRequest foo = GroupingRequest.newInstance(query);
assertEquals(List.of(foo), query.getSelect().getGrouping());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java
index 800faa4c0d1..19fd4234cfc 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java
@@ -4,7 +4,6 @@ package com.yahoo.search.grouping.request;
import org.junit.jupiter.api.Test;
import java.text.ChoiceFormat;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -72,30 +71,30 @@ public class BucketResolverTestCase {
@Test
void testBucketType() {
- checkPushFail(Arrays.asList((ConstantValue) new StringValue("a"), new LongValue(1L)),
+ checkPushFail(List.of((ConstantValue) new StringValue("a"), new LongValue(1L)),
"Bucket type mismatch, expected 'StringValue' got 'LongValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new StringValue("a"), new DoubleValue(1.0)),
+ checkPushFail(List.of((ConstantValue) new StringValue("a"), new DoubleValue(1.0)),
"Bucket type mismatch, expected 'StringValue' got 'DoubleValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new LongValue(1L), new StringValue("a")),
+ checkPushFail(List.of((ConstantValue) new LongValue(1L), new StringValue("a")),
"Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new LongValue(1L), new DoubleValue(1.0)),
+ checkPushFail(List.of((ConstantValue) new LongValue(1L), new DoubleValue(1.0)),
"Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new DoubleValue(1.0), new StringValue("a")),
+ checkPushFail(List.of((ConstantValue) new DoubleValue(1.0), new StringValue("a")),
"Bucket type mismatch, expected 'DoubleValue' got 'StringValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new DoubleValue(1.0), new LongValue(1L)),
+ checkPushFail(List.of((ConstantValue) new DoubleValue(1.0), new LongValue(1L)),
"Bucket type mismatch, expected 'DoubleValue' got 'LongValue'.");
- checkPushFail(Arrays.asList((ConstantValue) new InfiniteValue(new Infinite(true)), new InfiniteValue(new Infinite(false))),
+ checkPushFail(List.of((ConstantValue) new InfiniteValue(new Infinite(true)), new InfiniteValue(new Infinite(false))),
"Bucket type mismatch, cannot both be infinity.");
}
@Test
void testBucketOrder() {
- checkPushFail(Arrays.asList((ConstantValue) new LongValue(2L), new LongValue(1L)),
+ checkPushFail(List.of((ConstantValue) new LongValue(2L), new LongValue(1L)),
"Bucket to-value can not be less than from-value.");
- checkPushFail(Arrays.asList((ConstantValue) new DoubleValue(2.0), new DoubleValue(1.0)),
+ checkPushFail(List.of((ConstantValue) new DoubleValue(2.0), new DoubleValue(1.0)),
"Bucket to-value can not be less than from-value.");
- checkPushFail(Arrays.asList((ConstantValue) new StringValue("b"), new StringValue("a")),
+ checkPushFail(List.of((ConstantValue) new StringValue("b"), new StringValue("a")),
"Bucket to-value can not be less than from-value.");
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java
index 85f19e0b19a..daed437e93f 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java
@@ -9,6 +9,7 @@ import static org.junit.jupiter.api.Assertions.*;
* @author Einar M R Rosenvinge
*/
public class MathFunctionsTestCase {
+ private static final DoubleValue ZERO = new DoubleValue(0.0);
@Test
void testMathFunctions() {
@@ -37,27 +38,27 @@ public class MathFunctionsTestCase {
assertSame(MathFunctions.Function.create(19), MathFunctions.Function.HYPOT);
assertSame(MathFunctions.Function.create(20), MathFunctions.Function.FLOOR);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.EXP, null, null) instanceof MathExpFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.POW, null, null) instanceof MathPowFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG, null, null) instanceof MathLogFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG1P, null, null) instanceof MathLog1pFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG10, null, null) instanceof MathLog10Function);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.SIN, null, null) instanceof MathSinFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ASIN, null, null) instanceof MathASinFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.COS, null, null) instanceof MathCosFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ACOS, null, null) instanceof MathACosFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.TAN, null, null) instanceof MathTanFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ATAN, null, null) instanceof MathATanFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.SQRT, null, null) instanceof MathSqrtFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.SINH, null, null) instanceof MathSinHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ASINH, null, null) instanceof MathASinHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.COSH, null, null) instanceof MathCosHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ACOSH, null, null) instanceof MathACosHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.TANH, null, null) instanceof MathTanHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.ATANH, null, null) instanceof MathATanHFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.CBRT, null, null) instanceof MathCbrtFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.HYPOT, null, null) instanceof MathHypotFunction);
- assertTrue(MathFunctions.newInstance(MathFunctions.Function.FLOOR, null, null) instanceof MathFloorFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.EXP, ZERO, ZERO) instanceof MathExpFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.POW, ZERO, ZERO) instanceof MathPowFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG, ZERO, ZERO) instanceof MathLogFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG1P, ZERO, ZERO) instanceof MathLog1pFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.LOG10, ZERO, ZERO) instanceof MathLog10Function);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.SIN, ZERO, ZERO) instanceof MathSinFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ASIN, ZERO, ZERO) instanceof MathASinFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.COS, ZERO, ZERO) instanceof MathCosFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ACOS, ZERO, ZERO) instanceof MathACosFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.TAN, ZERO, ZERO) instanceof MathTanFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ATAN, ZERO, ZERO) instanceof MathATanFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.SQRT, ZERO, ZERO) instanceof MathSqrtFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.SINH, ZERO, ZERO) instanceof MathSinHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ASINH, ZERO, ZERO) instanceof MathASinHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.COSH, ZERO, ZERO) instanceof MathCosHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ACOSH, ZERO, ZERO) instanceof MathACosHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.TANH, ZERO, ZERO) instanceof MathTanHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.ATANH, ZERO, ZERO) instanceof MathATanHFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.CBRT, ZERO, ZERO) instanceof MathCbrtFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.HYPOT, ZERO, ZERO) instanceof MathHypotFunction);
+ assertTrue(MathFunctions.newInstance(MathFunctions.Function.FLOOR, ZERO, ZERO) instanceof MathFloorFunction);
}
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java
index babeebdf8c1..71ffc5e928d 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java
@@ -4,7 +4,6 @@ package com.yahoo.search.grouping.request;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -42,8 +41,8 @@ public class RawBufferTestCase {
@Test
void requireThatToStringWorks() {
- assertToString(Arrays.asList("a".getBytes()[0], "b".getBytes()[0]), "{97,98}");
- assertToString(Arrays.asList((byte) 2, (byte) 6), "{2,6}");
+ assertToString(List.of("a".getBytes()[0], "b".getBytes()[0]), "{97,98}");
+ assertToString(List.of((byte) 2, (byte) 6), "{2,6}");
}
public void assertToString(List<Byte> data, String expected) {
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java
index 0b6ab49867b..24049264d4b 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.search.grouping.request;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -17,7 +17,7 @@ public class RequestTestCase {
GroupingOperation op = new AllOperation()
.setGroupBy(new AttributeValue("foo"))
.addOrderBy(new CountAggregator())
- .addChildren(Arrays.asList(new AllOperation(), new EachOperation()))
+ .addChildren(List.of(new AllOperation(), new EachOperation()))
.addChild(new EachOperation()
.addOutput(new CountAggregator())
.addOutput(new MinAggregator(new AttributeValue("bar")))
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java
index 2471acfb115..4d03c4aff95 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java
@@ -4,7 +4,6 @@ package com.yahoo.search.grouping.request.parser;
import com.yahoo.search.grouping.request.GroupingOperation;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -51,7 +50,7 @@ public class GroupingParserBenchmarkTest {
}
private static List<String> getInputs() {
- return Arrays.asList(
+ return List.of(
" all(group(foo)each(output(max(bar))))",
"all( group(foo)each(output(max(bar))))",
"all(group( foo)each(output(max(bar))))",
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java
index e78ebfbd5af..01963e94546 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java
@@ -13,7 +13,6 @@ import com.yahoo.search.yql.YqlParser;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -29,7 +28,7 @@ public class GroupingParserTestCase {
@Test
void requireThatMathAllowsWhitespace() {
- for (String op : Arrays.asList("+", " +", " + ", "+ ",
+ for (String op : List.of("+", " +", " + ", "+ ",
"-", " -", " - ", "- ",
"*", " *", " * ", "* ",
"/", " /", " / ", "/ ",
@@ -64,7 +63,7 @@ public class GroupingParserTestCase {
@Test
void requireThatTokenImagesAreNotReservedWords() {
- List<String> images = Arrays.asList("acos",
+ List<String> images = List.of("acos",
"acosh",
"accuracy",
"add",
@@ -489,7 +488,7 @@ public class GroupingParserTestCase {
@Test
void testMisc() {
- for (String fnc : Arrays.asList("time.date",
+ for (String fnc : List.of("time.date",
"time.dayofmonth",
"time.dayofweek",
"time.dayofyear",
@@ -634,7 +633,7 @@ public class GroupingParserTestCase {
actual.add(operation.toString());
}
if (expectedOperations.length > 0) {
- assertEquals(Arrays.asList(expectedOperations), actual);
+ assertEquals(List.of(expectedOperations), actual);
}
// make sure that operation does not mutate through toString() -> fromString()
@@ -656,7 +655,7 @@ public class GroupingParserTestCase {
actual.add(step.getOperation().toString());
}
if (expectedOperations.length > 0) {
- assertEquals(Arrays.asList(expectedOperations), actual);
+ assertEquals(List.of(expectedOperations), actual);
}
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
index 9e8fcb0ea21..c17bc985aef 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
@@ -28,7 +28,6 @@ import com.yahoo.searchlib.aggregation.hll.SparseSketch;
import com.yahoo.searchlib.expression.StringResultNode;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
@@ -105,7 +104,7 @@ public class FlatteningSearcherTestCase {
}
private static Execution newExecution(Searcher... searchers) {
- return new Execution(new SearchChain(new ComponentId("foo"), Arrays.asList(searchers)),
+ return new Execution(new SearchChain(new ComponentId("foo"), List.of(searchers)),
Execution.Context.createContextStub());
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java
index ef2ef9724a9..780066d0afe 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java
@@ -35,7 +35,6 @@ import com.yahoo.searchlib.expression.StringResultNode;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -180,7 +179,7 @@ public class GroupingExecutorTestCase {
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MinAggregationResult().setMin(new IntegerResultNode(6)).setTag(3)))
);
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grpA), null, query),
new GroupingListHit(List.of(grpB), null, query))));
Group grp = req.getResultGroup(exec.search(query));
@@ -213,7 +212,7 @@ public class GroupingExecutorTestCase {
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("unexpected")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(96)).setTag(3)))
);
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grpExpected), null, query),
new GroupingListHit(List.of(grpUnexpected), null, query))));
Group grp = req.getResultGroup(exec.search(query));
@@ -244,7 +243,7 @@ public class GroupingExecutorTestCase {
.addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))
));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grp0), null, query),
new GroupingListHit(List.of(grp1), null, query))),
new FillRequestThrower());
@@ -284,7 +283,7 @@ public class GroupingExecutorTestCase {
new HitsAggregationResult(1, "bar")
.addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grp0), null, query),
new GroupingListHit(List.of(grp1), null, query))),
new FillErrorProvider());
@@ -310,7 +309,7 @@ public class GroupingExecutorTestCase {
.addAggregationResult(new CountAggregationResult(2))
.addOrderBy(new AggregationRefNode(0), true)));
Result res = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grp), null, query),
new GroupingListHit(List.of(grp), null, query)))).search(query);
@@ -339,7 +338,7 @@ public class GroupingExecutorTestCase {
ErrorProvider err = new ErrorProvider(1);
Execution exec = newExecution(new GroupingExecutor(),
err,
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grp0), null, query),
new GroupingListHit(List.of(grp1), null, query))));
Result res = exec.search(query);
@@ -350,7 +349,7 @@ public class GroupingExecutorTestCase {
err = new ErrorProvider(0);
exec = newExecution(new GroupingExecutor(),
err,
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(grp0), null, query),
new GroupingListHit(List.of(grp1), null, query))));
res = exec.search(query);
@@ -389,9 +388,9 @@ public class GroupingExecutorTestCase {
));
SummaryMapper sm = new SummaryMapper();
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(Arrays.asList(pass0A, pass0B), null, query),
- new GroupingListHit(Arrays.asList(pass1A, pass1B), null, query))),
+ new ResultProvider(List.of(
+ new GroupingListHit(List.of(pass0A, pass0B), null, query),
+ new GroupingListHit(List.of(pass1A, pass1B), null, query))),
sm);
exec.fill(exec.search(query), "default");
assertEquals(2, sm.hitsBySummary.size());
@@ -433,7 +432,7 @@ public class GroupingExecutorTestCase {
new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME)
.addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(pass0), null, query),
new GroupingListHit(List.of(pass1), null, query))));
Result res = exec.search(query);
@@ -468,7 +467,7 @@ public class GroupingExecutorTestCase {
QueryMapper qm = new QueryMapper();
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(pass0, pass1)),
+ new ResultProvider(List.of(pass0, pass1)),
qm);
exec.fill(exec.search(queryA));
assertEquals(1, qm.hitsByQuery.size());
@@ -607,7 +606,7 @@ public class GroupingExecutorTestCase {
}
private static Execution newExecution(Searcher... searchers) {
- return new Execution(new SearchChain(new ComponentId("foo"), Arrays.asList(searchers)),
+ return new Execution(new SearchChain(new ComponentId("foo"), List.of(searchers)),
Execution.Context.createContextStub());
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java
index 6230899ec49..7e049e44f4d 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java
@@ -36,7 +36,6 @@ import com.yahoo.searchlib.expression.StringResultNode;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -916,10 +915,11 @@ public class ResultBuilderTestCase {
assertOutput(test);
}
+
private static void assertOutput(ResultTest test) {
RequestBuilder reqBuilder = new RequestBuilder(REQUEST_ID);
reqBuilder.setRootOperation(GroupingOperation.fromString(test.request));
- reqBuilder.addContinuations(Arrays.asList(test.continuation));
+ reqBuilder.addContinuations(test.getContinuations());
reqBuilder.build();
assertEquals(reqBuilder.getRequestList().size(), test.result.size());
@@ -973,6 +973,9 @@ public class ResultBuilderTestCase {
String expectedException;
OutputWriter outputWriter;
Continuation continuation;
+ List<Continuation> getContinuations() {
+ return continuation != null ? List.of(continuation) : List.of();
+ }
}
private static interface OutputWriter {
diff --git a/container-search/src/test/java/com/yahoo/search/pagetemplates/test/PageTemplateSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/pagetemplates/test/PageTemplateSearcherTestCase.java
index 1869e0e4bf0..78875b5b831 100644
--- a/container-search/src/test/java/com/yahoo/search/pagetemplates/test/PageTemplateSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/pagetemplates/test/PageTemplateSearcherTestCase.java
@@ -100,7 +100,7 @@ public class PageTemplateSearcherTestCase {
{ // Specifying two templates as a list, should override the page.id setting
Query query = new Query("?query=foo&page.id=anySource&page.resolver=native.deterministic");
- query.properties().set("page.idList", Arrays.asList("oneSource", "threeSources"));
+ query.properties().set("page.idList", List.of("oneSource", "threeSources"));
Result result = new Execution(chain, Execution.Context.createContextStub()).search(query);
assertSources("source1 source2 source3", "source1 source2 source3", result);
}
@@ -172,11 +172,11 @@ public class PageTemplateSearcherTestCase {
}
private void assertSources(String expectedQuerySourceString,String expectedResultSourceString,Result result) {
- Set<String> expectedQuerySources=new HashSet<>(Arrays.asList(expectedQuerySourceString.split(" ")));
+ Set<String> expectedQuerySources=new HashSet<>(List.of(expectedQuerySourceString.split(" ")));
assertEquals(expectedQuerySources,result.getQuery().getModel().getSources());
- Set<String> expectedResultSources=new HashSet<>(Arrays.asList(expectedResultSourceString.split(" ")));
- for (String sourceName : Arrays.asList("source1 source2 source3".split(" "))) {
+ Set<String> expectedResultSources=new HashSet<>(List.of(expectedResultSourceString.split(" ")));
+ for (String sourceName : List.of("source1 source2 source3".split(" "))) {
if (expectedResultSources.contains(sourceName))
assertNotNull(result.hits().get(sourceName),"Result contains '" + sourceName + "'");
else
@@ -189,7 +189,7 @@ public class PageTemplateSearcherTestCase {
@Override
public Result search(Query query,Execution execution) {
Result result=new Result(query);
- for (String sourceName : Arrays.asList("source1 source2 source3".split(" ")))
+ for (String sourceName : List.of("source1 source2 source3".split(" ")))
if (query.getModel().getSources().isEmpty() || query.getModel().getSources().contains(sourceName))
result.hits().add(createSource(sourceName));
return result;
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/properties/test/PropertyMapTestCase.java b/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java
index 42dcab41015..793a907b5d1 100644
--- a/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/properties/test/PropertyMapTestCase.java
@@ -4,7 +4,6 @@ package com.yahoo.search.query.properties.test;
import com.yahoo.processing.request.properties.PropertyMap;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -22,8 +21,8 @@ public class PropertyMapTestCase {
map.set("nonclonable", new NonClonableObject());
map.set("clonableArray", new ClonableObject[]{new ClonableObject()});
map.set("nonclonableArray", new NonClonableObject[]{new NonClonableObject()});
- map.set("clonableList", Collections.singletonList(new ClonableObject()));
- map.set("nonclonableList", Collections.singletonList(new NonClonableObject()));
+ map.set("clonableList", List.of(new ClonableObject()));
+ map.set("nonclonableList", List.of(new NonClonableObject()));
assertNotNull(map.get("clonable"));
assertNotNull(map.get("nonclonable"));
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) {
diff --git a/container-search/src/test/java/com/yahoo/search/ranking/GlobalPhaseRerankHitsImplTest.java b/container-search/src/test/java/com/yahoo/search/ranking/GlobalPhaseRerankHitsImplTest.java
index 39b202daf1e..b37e1d5551b 100644
--- a/container-search/src/test/java/com/yahoo/search/ranking/GlobalPhaseRerankHitsImplTest.java
+++ b/container-search/src/test/java/com/yahoo/search/ranking/GlobalPhaseRerankHitsImplTest.java
@@ -35,7 +35,7 @@ public class GlobalPhaseRerankHitsImplTest {
}
}
static FunEvalSpec makeConstSpec(double constValue) {
- return new FunEvalSpec(() -> new EvalSum(constValue), Collections.emptyList(), Collections.emptyList());
+ return new FunEvalSpec(() -> new EvalSum(constValue), List.of(), List.of());
}
static FunEvalSpec makeSumSpec(List<String> fromQuery, List<String> fromMF) {
List<MatchFeatureInput> mfList = new ArrayList<>();
@@ -175,15 +175,15 @@ public class GlobalPhaseRerankHitsImplTest {
}
@Test void partialRerankWithRescaling() {
var setup = setup().rerank(2).eval(makeConstSpec(3.0)).build();
- var query = makeQuery(Collections.emptyList());
+ var query = makeQuery(List.of());
var result = makeResult(query, List.of(hit("a", 3), hit("b", 4), hit("c", 5), hit("d", 6)));
var expect = Expect.make(List.of(hit("a", 1), hit("b", 2), hit("c", 3), hit("d", 3)));
GlobalPhaseRanker.rerankHitsImpl(setup, query, result);
expect.verifyScores(result);
}
@Test void matchFeaturesCanBePartiallyHidden() {
- var setup = setup().eval(makeSumSpec(Collections.emptyList(), List.of("public_value", "private_value"))).hide("private_value").build();
- var query = makeQuery(Collections.emptyList());
+ var setup = setup().eval(makeSumSpec(List.of(), List.of("public_value", "private_value"))).hide("private_value").build();
+ var query = makeQuery(List.of());
var factory = new HitFactory(List.of("public_value", "private_value"));
var result = makeResult(query, List.of(factory.create("a", 1, List.of(value("public_value", 2), value("private_value", 3))),
factory.create("b", 2, List.of(value("public_value", 5), value("private_value", 7)))));
@@ -194,8 +194,8 @@ public class GlobalPhaseRerankHitsImplTest {
verifyDoesNotHaveMF(result, "private_value");
}
@Test void matchFeaturesCanBeRemoved() {
- var setup = setup().eval(makeSumSpec(Collections.emptyList(), List.of("private_value"))).hide("private_value").build();
- var query = makeQuery(Collections.emptyList());
+ var setup = setup().eval(makeSumSpec(List.of(), List.of("private_value"))).hide("private_value").build();
+ var query = makeQuery(List.of());
var factory = new HitFactory(List.of("private_value"));
var result = makeResult(query, List.of(factory.create("a", 1, List.of(value("private_value", 3))),
factory.create("b", 2, List.of(value("private_value", 7)))));
@@ -227,7 +227,7 @@ public class GlobalPhaseRerankHitsImplTest {
verifyHasMF(result, "bar");
}
@Test void queryFeaturesCanBeDefaultValues() {
- var setup = setup().eval(makeSumSpec(List.of("foo", "bar"), Collections.emptyList()))
+ var setup = setup().eval(makeSumSpec(List.of("foo", "bar"), List.of()))
.addDefault("query(bar)", Tensor.from(5.0)).build();
var query = makeQuery(List.of(value("query(foo)", 7)));
var result = makeResult(query, List.of(hit("a", 1)));
@@ -236,7 +236,7 @@ public class GlobalPhaseRerankHitsImplTest {
expect.verifyScores(result);
}
@Test void withNormalizer() {
- var setup = setup().eval(makeSumSpec(Collections.emptyList(), List.of("bar")))
+ var setup = setup().eval(makeSumSpec(List.of(), List.of("bar")))
.addNormalizer(makeNormalizer("foo", List.of(115.0, 65.0, 55.0, 45.0, 15.0), makeSumSpec(List.of("x"), List.of("bar")))).build();
var query = makeQuery(List.of(value("query(x)", 5)));
var factory = new HitFactory(List.of("bar"));
diff --git a/container-search/src/test/java/com/yahoo/search/result/test/FillingTestCase.java b/container-search/src/test/java/com/yahoo/search/result/test/FillingTestCase.java
index 298673a1ae7..d8f4f39c5b8 100644
--- a/container-search/src/test/java/com/yahoo/search/result/test/FillingTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/result/test/FillingTestCase.java
@@ -5,7 +5,8 @@ import com.yahoo.search.result.Hit;
import com.yahoo.search.result.HitGroup;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+
+import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
@@ -63,7 +64,7 @@ public class FillingTestCase {
hits.add(hit1);
hits.add(hit2);
- assertEquals(Collections.emptySet(), hits.getFilled());
+ assertEquals(Set.of(), hits.getFilled());
}
@Test
@@ -82,7 +83,7 @@ public class FillingTestCase {
hits.add(hit2);
hits.add(hit3);
- assertEquals(Collections.singleton("summary1"), hits.getFilled());
+ assertEquals(Set.of("summary1"), hits.getFilled());
}
private Hit createNonFilled(String id) {
diff --git a/container-search/src/test/java/com/yahoo/search/result/test/HitGroupTestCase.java b/container-search/src/test/java/com/yahoo/search/result/test/HitGroupTestCase.java
index 5f8fbbd08df..42098051b82 100644
--- a/container-search/src/test/java/com/yahoo/search/result/test/HitGroupTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/result/test/HitGroupTestCase.java
@@ -9,7 +9,6 @@ import com.yahoo.search.result.Hit;
import com.yahoo.search.result.HitGroup;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@@ -165,14 +164,14 @@ public class HitGroupTestCase {
Hit hit = new Hit("http://nalle.balle/1.html", 832);
hit.setField("url", "http://nalle.balle/1.html");
hit.setField("clickurl", "javascript:openWindow('http://www.foo');");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hg.add(hit);
}
{
Hit hit = new Hit("http://nalle.balle/2.html", 442);
hit.setField("url", "http://nalle.balle/2.html");
hit.setField("clickurl", "");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hg.add(hit);
}
assertFalse(hg.isFillable());
@@ -187,7 +186,7 @@ public class HitGroupTestCase {
Hit hit = new Hit("http://nalle.balle/1.html", 832);
hit.setField("url", "http://nalle.balle/1.html");
hit.setField("clickurl", "javascript:openWindow('http://www.foo');");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hit.setFillable();
hg.add(hit);
}
@@ -195,7 +194,7 @@ public class HitGroupTestCase {
Hit hit = new Hit("http://nalle.balle/2.html", 442);
hit.setField("url", "http://nalle.balle/2.html");
hit.setField("clickurl", "");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hit.setFillable();
hg.add(hit);
}
@@ -211,14 +210,14 @@ public class HitGroupTestCase {
Hit hit = new Hit("http://nalle.balle/1.html", 832);
hit.setField("url", "http://nalle.balle/1.html");
hit.setField("clickurl", "javascript:openWindow('http://www.foo');");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hg.add(hit);
}
{
Hit hit = new Hit("http://nalle.balle/2.html", 442);
hit.setField("url", "http://nalle.balle/2.html");
hit.setField("clickurl", "");
- hit.setField("attributes", Arrays.asList("typevideo"));
+ hit.setField("attributes", List.of("typevideo"));
hg.add(hit);
}
assertFalse(hg.isFillable());
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionTestCase.java
index e8a85e38e80..1bf04eb44fb 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/AsyncExecutionTestCase.java
@@ -10,7 +10,6 @@ import com.yahoo.search.result.Hit;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -70,20 +69,20 @@ public class AsyncExecutionTestCase {
void testWaitForAll() {
Chain<Searcher> slowChain = new Chain<>(
new ComponentId("slow"),
- Arrays.asList(new Searcher[]{new WaitingSearcher("slow", 30000)}
+ List.of(new Searcher[]{new WaitingSearcher("slow", 30000)}
)
);
Chain<Searcher> fastChain = new Chain<>(
new ComponentId("fast"),
- Arrays.asList(new Searcher[]{new SimpleSearcher()})
+ List.of(new Searcher[]{new SimpleSearcher()})
);
FutureResult slowFuture = new AsyncExecution(slowChain, Execution.Context.createContextStub()).search(new Query("?hits=0"));
FutureResult fastFuture = new AsyncExecution(fastChain, Execution.Context.createContextStub()).search(new Query("?hits=0"));
fastFuture.get();
FutureResult [] reslist = new FutureResult[]{slowFuture, fastFuture};
- List<Result> results = AsyncExecution.waitForAll(Arrays.asList(reslist), 0);
+ List<Result> results = AsyncExecution.waitForAll(List.of(reslist), 0);
//assertTrue(slowFuture.isCancelled());
assertTrue(fastFuture.isDone() && !fastFuture.isCancelled());
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java
index 924aa7ae999..16e9adecdba 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.search.searchchain.config.test;
import java.io.File;
import java.io.IOException;
-import java.util.Arrays;
+import java.util.List;
import com.yahoo.component.chain.dependencies.After;
@@ -72,8 +72,8 @@ public class DependencyConfigTestCase {
void test() {
Dependencies dependencies = registry.getSearcherRegistry().getComponent(Searcher1.class.getName()).getDependencies();
- assertTrue(dependencies.provides().containsAll(Arrays.asList("P", "P1", "P2", Searcher1.class.getSimpleName())));
- assertTrue(dependencies.before().containsAll(Arrays.asList("B", "B1", "B2")));
- assertTrue(dependencies.after().containsAll(Arrays.asList("A", "A1", "A2")));
+ assertTrue(dependencies.provides().containsAll(List.of("P", "P1", "P2", Searcher1.class.getSimpleName())));
+ assertTrue(dependencies.before().containsAll(List.of("B", "B1", "B2")));
+ assertTrue(dependencies.after().containsAll(List.of("A", "A1", "A2")));
}
}
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java
index bfcde54d65b..fda7bec9d71 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java
@@ -16,7 +16,7 @@ import com.yahoo.search.searchchain.SearchChainRegistry;
import com.yahoo.search.searchchain.model.federation.FederationOptions;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
@@ -82,7 +82,7 @@ public class FutureDataTestCase {
void testFutureData() throws InterruptedException, ExecutionException, TimeoutException {
// Set up
AsyncProviderSearcher futureDataSource = new AsyncProviderSearcher();
- Chain<Searcher> chain = new Chain<>(Collections.<Searcher>singletonList(futureDataSource));
+ Chain<Searcher> chain = new Chain<>(List.of(futureDataSource));
// Execute
Query query = new Query();
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/test/SearchChainTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/test/SearchChainTestCase.java
index 2f04b695774..87384a15979 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/test/SearchChainTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/test/SearchChainTestCase.java
@@ -5,7 +5,6 @@ import static com.yahoo.search.searchchain.test.SimpleSearchChain.searchChain;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -40,7 +39,7 @@ public class SearchChainTestCase {
assertEquals("test", searchChain.getId().getName());
assertEquals(Version.emptyVersion, searchChain.getId().getVersion());
assertEquals(new Version(), searchChain.getId().getVersion());
- assertEqualMembers(Arrays.asList("one", "two"), searcherNames(searchChain.searchers()));
+ assertEqualMembers(List.of("one", "two"), searcherNames(searchChain.searchers()));
}
public List<String> searcherNames(Collection<Searcher> searchers) {
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/test/SimpleSearchChain.java b/container-search/src/test/java/com/yahoo/search/searchchain/test/SimpleSearchChain.java
index de2fc46d803..833fd2c8657 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/test/SimpleSearchChain.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/test/SimpleSearchChain.java
@@ -2,7 +2,6 @@
package com.yahoo.search.searchchain.test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -38,7 +37,7 @@ public class SimpleSearchChain {
@Override
public Collection<ForkingSearcher.CommentedSearchChain> getSearchChainsForwarded(SearchChainRegistry registry) {
- return Arrays.asList(
+ return List.of(
new ForkingSearcher.CommentedSearchChain("Reason for forwarding to this search chain.", dummySearchChain()),
new ForkingSearcher.CommentedSearchChain(null, dummySearchChain()));
}
diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/test/TraceTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/test/TraceTestCase.java
index 036c41aab66..fb77073f68e 100644
--- a/container-search/src/test/java/com/yahoo/search/searchchain/test/TraceTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/searchchain/test/TraceTestCase.java
@@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -308,7 +307,7 @@ public class TraceTestCase {
public Forker(boolean carryOverContext, boolean parallel, Searcher ... branches) {
this.carryOverContext = carryOverContext;
this.parallel = parallel;
- this.branches = Arrays.asList(branches);
+ this.branches = List.of(branches);
}
@Override
diff --git a/container-search/src/test/java/com/yahoo/search/searchers/test/MockMetric.java b/container-search/src/test/java/com/yahoo/search/searchers/test/MockMetric.java
deleted file mode 100644
index 7835a9934c7..00000000000
--- a/container-search/src/test/java/com/yahoo/search/searchers/test/MockMetric.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.search.searchers.test;
-
-import com.yahoo.jdisc.Metric;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
-* @author bratseth
-*/
-class MockMetric implements Metric {
-
- private Map<Context, Map<String, Number>> metrics = new HashMap<>();
-
- public Map<String, Number> values(Context context) {
- return metricsForContext(context);
- }
-
- @Override
- public void set(String key, Number val, Context context) {
- metricsForContext(context).put(key, val);
- }
-
- @Override
- public void add(String key, Number value, Context context) {
- Number previousValue = metricsForContext(context).get(key);
- if (previousValue == null)
- previousValue = 0;
- metricsForContext(context).put(key, value.doubleValue() + previousValue.doubleValue());
- }
-
- /** Returns the metrics for a given context, never null */
- private Map<String, Number> metricsForContext(Context context) {
- Map<String, Number> metricsForContext = metrics.get(context);
- if (metricsForContext == null) {
- metricsForContext = new HashMap<>();
- metrics.put(context, metricsForContext);
- }
- return metricsForContext;
- }
-
- @Override
- public Context createContext(Map<String, ?> dimensions) {
- return new MapContext(dimensions);
- }
-
- /** Creates a context containing a single dimension */
- public Metric.Context createContext(String dimensionName, String dimensionValue) {
- if (dimensionName.isEmpty())
- return createContext(Collections.emptyMap());
- return createContext(Collections.singletonMap(dimensionName, dimensionValue));
- }
-
- private class MapContext implements Metric.Context {
-
- private final Map<String, ?> dimensions;
-
- public MapContext(Map<String, ?> dimensions) {
- this.dimensions = dimensions;
- }
-
- @Override
- public int hashCode() {
- return dimensions.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if ( ! (o instanceof MapContext)) return false;
- return dimensions.equals(((MapContext)o).dimensions);
- }
-
- }
-
-}
diff --git a/container-search/src/test/java/com/yahoo/search/yql/VespaSerializerTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/VespaSerializerTestCase.java
index 87bc602f072..20ca81234a6 100644
--- a/container-search/src/test/java/com/yahoo/search/yql/VespaSerializerTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/yql/VespaSerializerTestCase.java
@@ -27,7 +27,8 @@ import com.yahoo.search.query.QueryTree;
import com.yahoo.search.query.parser.Parsable;
import com.yahoo.search.query.parser.ParserEnvironment;
-import java.util.Arrays;
+
+import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -383,7 +384,7 @@ public class VespaSerializerTestCase {
private static void newGroupingRequest(Query query, GroupingOperation grouping, Continuation... continuations) {
GroupingRequest request = GroupingRequest.newInstance(query);
request.setRootOperation(grouping);
- request.continuations().addAll(Arrays.asList(continuations));
+ request.continuations().addAll(List.of(continuations));
}
@Test
diff --git a/container-search/src/test/java/com/yahoo/search/yql/YqlFieldAndSourceTestCase.java b/container-search/src/test/java/com/yahoo/search/yql/YqlFieldAndSourceTestCase.java
index 87d18c18db5..675acabe906 100644
--- a/container-search/src/test/java/com/yahoo/search/yql/YqlFieldAndSourceTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/yql/YqlFieldAndSourceTestCase.java
@@ -3,7 +3,6 @@ package com.yahoo.search.yql;
import static org.junit.jupiter.api.Assertions.*;
-import java.util.Arrays;
import java.util.List;
import com.yahoo.search.schema.DocumentSummary;
@@ -48,9 +47,9 @@ public class YqlFieldAndSourceTestCase {
DocumentSourceSearcher mockBackend = new DocumentSourceSearcher();
mockBackend.addResult(query, result);
- mockBackend.addSummaryClassByCopy(DEFAULT_SUMMARY_CLASS, Arrays.asList(FIELD1, FIELD2));
- mockBackend.addSummaryClassByCopy(SORTABLE_ATTRIBUTES_SUMMARY_CLASS, Arrays.asList(FIELD2));
- mockBackend.addSummaryClassByCopy(THIRD_OPTION, Arrays.asList(FIELD3));
+ mockBackend.addSummaryClassByCopy(DEFAULT_SUMMARY_CLASS, List.of(FIELD1, FIELD2));
+ mockBackend.addSummaryClassByCopy(SORTABLE_ATTRIBUTES_SUMMARY_CLASS, List.of(FIELD2));
+ mockBackend.addSummaryClassByCopy(THIRD_OPTION, List.of(FIELD3));
searchChain = new Chain<>(new FieldFiller(schemaInfo()), mockBackend);
context = Execution.Context.createContextStub();
diff --git a/container-search/src/test/java/com/yahoo/text/interpretation/test/AnnotationTestCase.java b/container-search/src/test/java/com/yahoo/text/interpretation/test/AnnotationTestCase.java
index dd2725f2d6e..3fa81e948a2 100644
--- a/container-search/src/test/java/com/yahoo/text/interpretation/test/AnnotationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/text/interpretation/test/AnnotationTestCase.java
@@ -2,7 +2,6 @@
package com.yahoo.text.interpretation.test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -50,7 +49,7 @@ public class AnnotationTestCase {
}
Set<AnnotationClass> annotationClasses = a.getClasses(0, 3);
- Set<AnnotationClass> testClass = new HashSet<>(Arrays.asList(
+ Set<AnnotationClass> testClass = new HashSet<>(List.of(
new AnnotationClass("token"), new AnnotationClass("state")));
assertEquals(testClass, annotationClasses);
@@ -75,7 +74,7 @@ public class AnnotationTestCase {
//This is bad about the API, getTokens may not necessairily return what a user thinks a token is
//But it should still be tested
a.annotate(0, 1, "n");
- Set<String> testSet = new HashSet<>(Arrays.asList("n", "york", "hotel"));
+ Set<String> testSet = new HashSet<>(List.of("n", "york", "hotel"));
for (Span span :a.getTokens()) {
assertTrue(testSet.remove(span.getText()));
}
@@ -118,7 +117,7 @@ public class AnnotationTestCase {
//if a number is not found
woe_id = annotations.getInteger("woe_id");
}
- assertEquals(Arrays.asList("crab"), toppings);
+ assertEquals(List.of("crab"), toppings);
assertEquals(2459115, woe_id);
}