aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java83
1 files changed, 39 insertions, 44 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
index d5630063f4b..dbc827ea5c2 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
@@ -30,7 +30,7 @@ import com.yahoo.search.schema.RankProfile;
import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
import com.yahoo.search.searchchain.Execution;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Collections;
@@ -39,11 +39,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
@@ -54,20 +50,20 @@ import static org.junit.Assert.assertTrue;
public class FastSearcherTestCase {
@Test
- public void testNullQuery() {
+ void testNullQuery() {
Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(Collections.emptyList()),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ MockDispatcher.create(Collections.emptyList()),
+ new SummaryParameters(null),
+ new ClusterParams("testhittype"),
+ documentdbInfoConfig("test"),
+ schemaInfo("test"));
String query = "?junkparam=ignored";
Result result = doSearch(fastSearcher, new Query(query), 0, 10);
ErrorMessage message = result.hits().getError();
- assertNotNull("Got error", message);
+ assertNotNull(message, "Got error");
assertEquals("Null query", message.getMessage());
assertEquals(query, message.getDetailedMessage());
assertEquals(Error.NULL_QUERY.code, message.getCode());
@@ -90,13 +86,13 @@ public class FastSearcherTestCase {
}
@Test
- public void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
+ void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(List.of(new Node(0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ MockDispatcher.create(List.of(new Node(0, "host0", 0))),
+ new SummaryParameters(null),
+ new ClusterParams("testhittype"),
+ documentdbInfoConfig("test"),
+ schemaInfo("test"));
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -113,32 +109,32 @@ public class FastSearcherTestCase {
}
@Test
- public void testRankProfileValidation() {
+ void testRankProfileValidation() {
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(List.of(new Node(0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ MockDispatcher.create(List.of(new Node(0, "host0", 0))),
+ new SummaryParameters(null),
+ new ClusterParams("testhittype"),
+ documentdbInfoConfig("test"),
+ schemaInfo("test"));
assertFalse(searchError("?query=q", fastSearcher).contains("does not contain requested rank profile"));
assertFalse(searchError("?query=q&ranking.profile=default", fastSearcher).contains("does not contain requested rank profile"));
assertTrue(searchError("?query=q&ranking.profile=nosuch", fastSearcher).contains("does not contain requested rank profile"));
}
@Test
- public void testSummaryNeedsQuery() {
+ void testSummaryNeedsQuery() {
var documentDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("test")));
var schema = new Schema.Builder("test")
- .add(new DocumentSummary.Builder("default").build())
- .add(new RankProfile.Builder("default").setHasRankFeatures(false)
- .setHasSummaryFeatures(false)
- .build());
+ .add(new DocumentSummary.Builder("default").build())
+ .add(new RankProfile.Builder("default").setHasRankFeatures(false)
+ .setHasSummaryFeatures(false)
+ .build());
FastSearcher backend = new FastSearcher("container.0",
- MockDispatcher.create(Collections.singletonList(new Node(0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentDb,
- new SchemaInfo(List.of(schema.build()), Map.of()));
+ MockDispatcher.create(Collections.singletonList(new Node(0, "host0", 0))),
+ new SummaryParameters(null),
+ new ClusterParams("testhittype"),
+ documentDb,
+ new SchemaInfo(List.of(schema.build()), Map.of()));
Query q = new Query("?query=foo");
Result result = doSearch(backend, q, 0, 10);
assertFalse(backend.summaryNeedsQuery(q));
@@ -150,15 +146,15 @@ public class FastSearcherTestCase {
}
@Test
- public void testSinglePassGroupingIsNotForcedWithSingleNodeGroups() {
+ void testSinglePassGroupingIsNotForcedWithSingleNodeGroups() {
MockDispatcher dispatcher = MockDispatcher.create(ImmutableList.of(new Node(0, "host0", 0), new Node(2, "host1", 0)));
FastSearcher fastSearcher = new FastSearcher("container.0",
- dispatcher,
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ dispatcher,
+ new SummaryParameters(null),
+ new ClusterParams("testhittype"),
+ documentdbInfoConfig("test"),
+ schemaInfo("test"));
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -180,14 +176,13 @@ public class FastSearcherTestCase {
}
private void assertForceSinglePassIs(boolean expected, GroupingOperation operation) {
- assertEquals("Force single pass is " + expected + " in " + operation,
- expected, operation.getForceSinglePass());
+ assertEquals(expected, operation.getForceSinglePass(), "Force single pass is " + expected + " in " + operation);
for (GroupingOperation child : operation.getChildren())
assertForceSinglePassIs(expected, child);
}
@Test
- public void testDispatchReconfig() {
+ void testDispatchReconfig() {
String clusterName = "a";
var b = new QrSearchersConfig.Builder();
var searchClusterB = new QrSearchersConfig.Searchcluster.Builder();