aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/grouping
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-28 12:54:37 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2022-07-28 14:51:34 +0200
commit34ec3d76225844cfed51e407b2f41cd3e311bf47 (patch)
tree8e8dccbd556c4fce1fba37cdf379538d61fe4922 /container-search/src/test/java/com/yahoo/search/grouping
parent30b533c56ff0286aa3831889f46ba7c19e393ec0 (diff)
Convert container-search to junit5
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/grouping')
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/ContinuationTestCase.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/GroupingQueryParserTestCase.java22
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/GroupingRequestTestCase.java18
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/GroupingValidatorTestCase.java47
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java74
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/BucketResolverTestCase.java52
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/ExpressionVisitorTestCase.java12
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java14
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/MathFunctionsTestCase.java10
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/MathResolverTestCase.java38
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/RawBufferTestCase.java22
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/RequestTestCase.java74
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserBenchmarkTest.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/request/parser/GroupingParserTestCase.java380
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java60
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java22
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java8
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java132
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/CompositeContinuationTestCase.java44
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingExecutorTestCase.java263
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingTransformTestCase.java72
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java22
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerDecoderTestCase.java9
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java6
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/OffsetContinuationTestCase.java26
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java486
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultBuilderTestCase.java898
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultIdTestCase.java22
30 files changed, 1424 insertions, 1441 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/ContinuationTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/ContinuationTestCase.java
index 217fd4af400..3dcfcb8480a 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/ContinuationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/ContinuationTestCase.java
@@ -1,10 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author Simon Thoresen Hult
@@ -14,7 +14,7 @@ public class ContinuationTestCase {
private static final String KNOWN_CONTINUATION = "BCBCBCBEBGBCBKCBACBKCCK";
@Test
- public void requireThatToStringCanBeParsedByFromString() {
+ void requireThatToStringCanBeParsedByFromString() {
Continuation cnt = Continuation.fromString(KNOWN_CONTINUATION);
assertNotNull(cnt);
assertEquals(KNOWN_CONTINUATION, cnt.toString());
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 bbb461a939c..4911a5b2543 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
@@ -7,13 +7,13 @@ import com.yahoo.search.grouping.request.EachOperation;
import com.yahoo.search.grouping.request.GroupingOperation;
import com.yahoo.search.searchchain.Execution;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.List;
import java.util.TimeZone;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -21,17 +21,17 @@ import static org.junit.Assert.*;
public class GroupingQueryParserTestCase {
@Test
- public void requireThatNoRequestIsSkipped() {
+ void requireThatNoRequestIsSkipped() {
assertEquals(Collections.emptyList(), executeQuery(null, null, null));
}
@Test
- public void requireThatEmptyRequestIsSkipped() {
+ void requireThatEmptyRequestIsSkipped() {
assertEquals(Collections.emptyList(), executeQuery("", null, null));
}
@Test
- public void requireThatRequestIsParsed() {
+ void requireThatRequestIsParsed() {
List<GroupingRequest> lst = executeQuery("all(group(foo) each(output(max(bar))))", null, null);
assertNotNull(lst);
assertEquals(1, lst.size());
@@ -41,7 +41,7 @@ public class GroupingQueryParserTestCase {
}
@Test
- public void requireThatRequestListIsParsed() {
+ void requireThatRequestListIsParsed() {
List<GroupingRequest> lst = executeQuery("all();each()", null, null);
assertNotNull(lst);
assertEquals(2, lst.size());
@@ -50,7 +50,7 @@ public class GroupingQueryParserTestCase {
}
@Test
- public void requireThatEachRightBelowAllParses() {
+ void requireThatEachRightBelowAllParses() {
List<GroupingRequest> lst = executeQuery("all(each(output(summary(bar))))",
null, null);
assertNotNull(lst);
@@ -64,9 +64,9 @@ public class GroupingQueryParserTestCase {
}
@Test
- public void requireThatContinuationListIsParsed() {
+ void requireThatContinuationListIsParsed() {
List<GroupingRequest> lst = executeQuery("all(group(foo) each(output(max(bar))))",
- "BCBCBCBEBGBCBKCBACBKCCK BCBBBBBDBF", null);
+ "BCBCBCBEBGBCBKCBACBKCCK BCBBBBBDBF", null);
assertNotNull(lst);
assertEquals(1, lst.size());
GroupingRequest req = lst.get(0);
@@ -76,7 +76,7 @@ public class GroupingQueryParserTestCase {
}
@Test
- public void requireThatTimeZoneIsParsed() {
+ void requireThatTimeZoneIsParsed() {
List<GroupingRequest> lst = executeQuery("all(group(foo) each(output(max(bar))))", null, "cet");
assertNotNull(lst);
assertEquals(1, lst.size());
@@ -88,7 +88,7 @@ public class GroupingQueryParserTestCase {
}
@Test
- public void requireThatTimeZoneHasUtcDefault() {
+ void requireThatTimeZoneHasUtcDefault() {
List<GroupingRequest> lst = executeQuery("all(group(foo) each(output(max(bar))))", null, null);
assertNotNull(lst);
assertEquals(1, lst.size());
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 4bc827dde7a..458039fb872 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
@@ -7,7 +7,7 @@ import com.yahoo.search.Result;
import com.yahoo.search.grouping.result.Group;
import com.yahoo.search.grouping.result.RootGroup;
import com.yahoo.search.result.Hit;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.util.ArrayList;
@@ -15,7 +15,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -23,7 +23,7 @@ import static org.junit.Assert.*;
public class GroupingRequestTestCase {
@Test
- public void requireThatContinuationListIsMutable() {
+ void requireThatContinuationListIsMutable() {
GroupingRequest req = GroupingRequest.newInstance(new Query());
assertTrue(req.continuations().isEmpty());
@@ -41,7 +41,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatResultIsFound() {
+ void requireThatResultIsFound() {
Query query = new Query();
GroupingRequest req = GroupingRequest.newInstance(query);
Result res = new Result(query);
@@ -57,7 +57,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatResultIsFoundAfterCloning() {
+ void requireThatResultIsFoundAfterCloning() {
Query query = new Query();
GroupingRequest req = GroupingRequest.newInstance(query);
Result res = new Result(query.clone());
@@ -73,7 +73,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatParallelRequestsAreSupported() {
+ void requireThatParallelRequestsAreSupported() {
Query query = new Query();
Result res = new Result(query);
@@ -94,7 +94,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatRemovedResultIsNull() {
+ void requireThatRemovedResultIsNull() {
Query query = new Query();
GroupingRequest req = GroupingRequest.newInstance(query);
Result res = new Result(query);
@@ -107,7 +107,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatNonGroupResultIsNull() {
+ void requireThatNonGroupResultIsNull() {
Query query = new Query();
GroupingRequest req = GroupingRequest.newInstance(query);
Result res = new Result(query);
@@ -119,7 +119,7 @@ public class GroupingRequestTestCase {
}
@Test
- public void requireThatGetRequestsReturnsAllRequests() {
+ void requireThatGetRequestsReturnsAllRequests() {
Query query = new Query();
assertEquals(Collections.emptyList(), query.getSelect().getGrouping());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/GroupingValidatorTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/GroupingValidatorTestCase.java
index 4f473b29918..4b5fb53b06a 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/GroupingValidatorTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/GroupingValidatorTestCase.java
@@ -7,13 +7,13 @@ import com.yahoo.search.Query;
import com.yahoo.search.config.ClusterConfig;
import com.yahoo.search.grouping.request.GroupingOperation;
import com.yahoo.search.searchchain.Execution;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -21,13 +21,14 @@ import static org.junit.Assert.fail;
public class GroupingValidatorTestCase {
@Test
- public void requireThatAvailableAttributesDoNotThrow() {
+ void requireThatAvailableAttributesDoNotThrow() {
validateGrouping(List.of("foo", "bar"),
- "all(group(foo) each(output(max(bar))))");;
+ "all(group(foo) each(output(max(bar))))");
+ ;
}
@Test
- public void requireThatUnavailableAttributesThrow() {
+ void requireThatUnavailableAttributesThrow() {
try {
validateGrouping(List.of("foo"), "all(group(foo) each(output(max(bar))))");
fail("Excpected exception");
@@ -38,20 +39,20 @@ public class GroupingValidatorTestCase {
}
@Test
- public void requireThatEnableFlagPreventsThrow() {
+ void requireThatEnableFlagPreventsThrow() {
Query query = createQuery("all(group(foo) each(output(max(bar))))");
query.properties().set(GroupingValidator.PARAM_ENABLED, "false");
validateGrouping(List.of("foo"), query);
}
@Test
- public void available_primitive_map_attribute_does_not_throw() {
+ void available_primitive_map_attribute_does_not_throw() {
validateGrouping(List.of("map.key", "map.value"),
"all(group(map{\"foo\"}) each(output(count())))");
}
@Test
- public void unavailable_primitive_map_key_attribute_throws() {
+ void unavailable_primitive_map_key_attribute_throws() {
try {
validateGrouping(List.of("null"), "all(group(map{\"foo\"}) each(output(count())))");
fail("Expected exception");
@@ -62,7 +63,7 @@ public class GroupingValidatorTestCase {
}
@Test
- public void unavailable_primitive_map_value_attribute_throws() {
+ void unavailable_primitive_map_value_attribute_throws() {
try {
validateGrouping(List.of("map.key"), "all(group(map{\"foo\"}) each(output(count())))");
fail("Expected exception");
@@ -73,13 +74,13 @@ public class GroupingValidatorTestCase {
}
@Test
- public void available_struct_map_attribute_does_not_throw() {
+ void available_struct_map_attribute_does_not_throw() {
validateGrouping(List.of("map.key", "map.value.name"),
"all(group(map{\"foo\"}.name) each(output(count())))");
}
@Test
- public void unavailable_struct_map_key_attribute_throws() {
+ void unavailable_struct_map_key_attribute_throws() {
try {
validateGrouping(List.of("null"), "all(group(map{\"foo\"}.name) each(output(count())))");
fail("Expected exception");
@@ -90,7 +91,7 @@ public class GroupingValidatorTestCase {
}
@Test
- public void unavailable_struct_map_value_attribute_throws() {
+ void unavailable_struct_map_value_attribute_throws() {
try {
validateGrouping(List.of("map.key"), "all(group(map{\"foo\"}.name) each(output(count())))");
fail("Expected exception");
@@ -101,16 +102,16 @@ public class GroupingValidatorTestCase {
}
@Test
- public void available_key_source_attribute_does_not_throw() {
+ void available_key_source_attribute_does_not_throw() {
validateGrouping(List.of("map.key", "map.value", "key_source"),
"all(group(map{attribute(key_source)}) each(output(count())))");
}
@Test
- public void unavailable_key_source_attribute_throws() {
+ void unavailable_key_source_attribute_throws() {
try {
validateGrouping(List.of("map.key", "map.value"),
- "all(group(map{attribute(key_source)}) each(output(count())))");
+ "all(group(map{attribute(key_source)}) each(output(count())))");
fail("Expected exception");
}
catch (UnavailableAttributeException e) {
@@ -119,29 +120,29 @@ public class GroupingValidatorTestCase {
}
@Test
- public void key_source_attribute_with_mismatching_data_type_throws() {
+ void key_source_attribute_with_mismatching_data_type_throws() {
try {
validateGrouping(setupMismatchingKeySourceAttribute(false),
- "all(group(map{attribute(key_source)}) each(output(count())))");
+ "all(group(map{attribute(key_source)}) each(output(count())))");
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("Grouping request references key source attribute 'key_source' with data type 'INT32' " +
- "that is different than data type 'STRING' of key attribute 'map.key'",
- e.getMessage());
+ "that is different than data type 'STRING' of key attribute 'map.key'",
+ e.getMessage());
}
}
@Test
- public void key_source_attribute_with_multi_value_collection_type_throws() {
+ void key_source_attribute_with_multi_value_collection_type_throws() {
try {
validateGrouping(setupMismatchingKeySourceAttribute(true),
- "all(group(map{attribute(key_source)}) each(output(count())))");
+ "all(group(map{attribute(key_source)}) each(output(count())))");
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("Grouping request references key source attribute 'key_source' which is not of single value type",
- e.getMessage());
+ e.getMessage());
}
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
index cb771ecb678..ffb69267212 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
@@ -15,11 +15,9 @@ import com.yahoo.search.result.Hit;
import com.yahoo.search.result.Relevance;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.yolean.Exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author andreer
@@ -27,21 +25,21 @@ import static org.junit.Assert.fail;
public class UniqueGroupingSearcherTestCase {
@Test
- public void testSkipGroupingBasedDedup() {
+ void testSkipGroupingBasedDedup() {
Result result = search("?query=foo",
- new MockResultProvider(0, false));
+ new MockResultProvider(0, false));
assertEquals(0, result.hits().size());
}
@Test
- public void testSkipGroupingBasedDedupIfMultiLevelSorting() {
+ void testSkipGroupingBasedDedupIfMultiLevelSorting() {
Result result = search("?query=foo&unique=fingerprint&sorting=-pubdate%20-[rank]",
- new MockResultProvider(0, false));
+ new MockResultProvider(0, false));
assertEquals(0, result.hits().size());
}
@Test
- public void testIllegalSortingSpec() {
+ void testIllegalSortingSpec() {
try {
search("?query=foo&unique=fingerprint&sorting=-1",
new MockResultProvider(0, true).addGroupList(new GroupList("fingerprint")));
@@ -49,31 +47,31 @@ public class UniqueGroupingSearcherTestCase {
} catch (IllegalArgumentException e) {
// As expected.
assertTrue(Exceptions.toMessageString(e).contains("Could not set 'ranking.sorting' to '-1': " +
- "Illegal attribute name '1' for sorting. " +
- "Requires '[\\[]*[a-zA-Z_][\\.a-zA-Z0-9_-]*[\\]]*'"));
+ "Illegal attribute name '1' for sorting. " +
+ "Requires '[\\[]*[a-zA-Z_][\\.a-zA-Z0-9_-]*[\\]]*'"));
}
}
@Test
- public void testGroupingBasedDedupNoGroupingHits() {
+ void testGroupingBasedDedupNoGroupingHits() {
Result result = search("?query=foo&unique=fingerprint",
- new MockResultProvider(0, true));
+ new MockResultProvider(0, true));
assertEquals(0, result.hits().size());
}
@Test
- public void testGroupingBasedDedupWithEmptyGroupingHitsList() {
+ void testGroupingBasedDedupWithEmptyGroupingHitsList() {
Result result = search("?query=foo&unique=fingerprint",
- new MockResultProvider(0, true).addGroupList(new GroupList("fingerprint")));
+ new MockResultProvider(0, true).addGroupList(new GroupList("fingerprint")));
assertEquals(0, result.hits().size());
assertEquals(0, result.getTotalHitCount());
}
@Test
- public void testGroupingBasedDedupWithNullGroupingResult() {
+ void testGroupingBasedDedupWithNullGroupingResult() {
try {
search("?query=foo&unique=fingerprint",
- new MockResultProvider(0, false));
+ new MockResultProvider(0, false));
fail();
} catch (IllegalStateException e) {
assertEquals("Failed to produce deduped result set.", e.getMessage());
@@ -81,7 +79,7 @@ public class UniqueGroupingSearcherTestCase {
}
@Test
- public void testGroupingBasedDedupWithGroupingHits() {
+ void testGroupingBasedDedupWithGroupingHits() {
GroupList fingerprint = new GroupList("fingerprint");
fingerprint.add(makeHitGroup("1"));
fingerprint.add(makeHitGroup("2"));
@@ -105,7 +103,7 @@ public class UniqueGroupingSearcherTestCase {
}
@Test
- public void testGroupingBasedDedupWithGroupingHitsAndSorting() {
+ void testGroupingBasedDedupWithGroupingHitsAndSorting() {
GroupList fingerprint = new GroupList("fingerprint");
fingerprint.add(makeSortingHitGroup("1"));
fingerprint.add(makeSortingHitGroup("2"));
@@ -130,29 +128,29 @@ public class UniqueGroupingSearcherTestCase {
}
@Test
- public void testBuildGroupingExpression() {
+ void testBuildGroupingExpression() {
assertEquals("all(group(title) max(11) output(count() as(uniqueCount)) each(max(1) each(output(summary())) " +
- "as(uniqueHits)))",
- UniqueGroupingSearcher
- .buildGroupingExpression("title", 11, null, null)
- .toString());
+ "as(uniqueHits)))",
+ UniqueGroupingSearcher
+ .buildGroupingExpression("title", 11, null, null)
+ .toString());
assertEquals("all(group(fingerprint) max(5) output(count() as(uniqueCount)) each(max(1) " +
- "each(output(summary(attributeprefetch))) as(uniqueHits)))",
- UniqueGroupingSearcher
- .buildGroupingExpression("fingerprint", 5, "attributeprefetch", null)
- .toString());
+ "each(output(summary(attributeprefetch))) as(uniqueHits)))",
+ UniqueGroupingSearcher
+ .buildGroupingExpression("fingerprint", 5, "attributeprefetch", null)
+ .toString());
assertEquals("all(group(fingerprint) max(5) order(neg(max(pubdate))) output(count() as(uniqueCount)) each(" +
- "all(group(neg(pubdate)) max(1) order(neg(max(pubdate))) each(each(output(summary())) " +
- "as(uniqueHits)) as(uniqueGroups))))",
- UniqueGroupingSearcher
- .buildGroupingExpression("fingerprint", 5, null, new Sorting("-pubdate"))
- .toString());
+ "all(group(neg(pubdate)) max(1) order(neg(max(pubdate))) each(each(output(summary())) " +
+ "as(uniqueHits)) as(uniqueGroups))))",
+ UniqueGroupingSearcher
+ .buildGroupingExpression("fingerprint", 5, null, new Sorting("-pubdate"))
+ .toString());
assertEquals("all(group(fingerprint) max(5) order(min(pubdate)) output(count() as(uniqueCount)) each(" +
- "all(group(pubdate) max(1) order(min(pubdate)) each(each(output(summary(attributeprefetch))) " +
- "as(uniqueHits)) as(uniqueGroups))))",
- UniqueGroupingSearcher
- .buildGroupingExpression("fingerprint", 5, "attributeprefetch", new Sorting("+pubdate"))
- .toString());
+ "all(group(pubdate) max(1) order(min(pubdate)) each(each(output(summary(attributeprefetch))) " +
+ "as(uniqueHits)) as(uniqueGroups))))",
+ UniqueGroupingSearcher
+ .buildGroupingExpression("fingerprint", 5, "attributeprefetch", new Sorting("+pubdate"))
+ .toString());
}
private static Group makeHitGroup(String name) {
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 50058f3777f..d7a888792d9 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
@@ -1,13 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.text.ChoiceFormat;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -22,7 +22,7 @@ public class BucketResolverTestCase {
// --------------------------------------------------------------------------------
@Test
- public void testResolve() {
+ void testResolve() {
BucketResolver resolver = new BucketResolver();
resolver.push(new StringValue("a"), true);
try {
@@ -71,32 +71,32 @@ public class BucketResolverTestCase {
}
@Test
- public void testBucketType() {
- checkPushFail(Arrays.asList((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)),
- "Bucket type mismatch, expected 'StringValue' got 'DoubleValue'.");
- checkPushFail(Arrays.asList((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)),
- "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
- checkPushFail(Arrays.asList((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)),
- "Bucket type mismatch, expected 'DoubleValue' got 'LongValue'.");
- checkPushFail(Arrays.asList((ConstantValue)new InfiniteValue(new Infinite(true)), new InfiniteValue(new Infinite(false))),
- "Bucket type mismatch, cannot both be infinity.");
+ void testBucketType() {
+ checkPushFail(Arrays.asList((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)),
+ "Bucket type mismatch, expected 'StringValue' got 'DoubleValue'.");
+ checkPushFail(Arrays.asList((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)),
+ "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
+ checkPushFail(Arrays.asList((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)),
+ "Bucket type mismatch, expected 'DoubleValue' got 'LongValue'.");
+ checkPushFail(Arrays.asList((ConstantValue) new InfiniteValue(new Infinite(true)), new InfiniteValue(new Infinite(false))),
+ "Bucket type mismatch, cannot both be infinity.");
}
@Test
- public void testBucketOrder() {
- checkPushFail(Arrays.asList((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)),
- "Bucket to-value can not be less than from-value.");
- checkPushFail(Arrays.asList((ConstantValue)new StringValue("b"), new StringValue("a")),
- "Bucket to-value can not be less than from-value.");
+ void testBucketOrder() {
+ checkPushFail(Arrays.asList((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)),
+ "Bucket to-value can not be less than from-value.");
+ checkPushFail(Arrays.asList((ConstantValue) new StringValue("b"), new StringValue("a")),
+ "Bucket to-value can not be less than from-value.");
}
public void assertBucketRange(BucketValue expected, ConstantValue from, boolean inclusiveFrom, ConstantValue to, boolean inclusiveTo) {
@@ -123,7 +123,7 @@ public class BucketResolverTestCase {
}
@Test
- public void requireThatBucketRangesWork() {
+ void requireThatBucketRangesWork() {
BucketValue expected = new LongBucket(2, 5);
assertBucketRange(expected, new LongValue(1), false, new LongValue(4), true);
assertBucketRange(expected, new LongValue(1), false, new LongValue(5), false);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/ExpressionVisitorTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/ExpressionVisitorTestCase.java
index 24ce3cfea32..1f800b37ff0 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/ExpressionVisitorTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/ExpressionVisitorTestCase.java
@@ -1,13 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import java.util.List;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
@@ -15,7 +15,7 @@ import static org.junit.Assert.assertTrue;
public class ExpressionVisitorTestCase {
@Test
- public void requireThatExpressionsAreVisited() {
+ void requireThatExpressionsAreVisited() {
GroupingOperation op = new AllOperation();
final List<GroupingExpression> lst = new LinkedList<>();
@@ -38,7 +38,7 @@ public class ExpressionVisitorTestCase {
}
@Test
- public void requireThatChildOperationsAreVisited() {
+ void requireThatChildOperationsAreVisited() {
GroupingOperation root, parentA, childA1, childA2, parentB, childB1;
root = new AllOperation()
.addChild(parentA = new AllOperation()
@@ -69,7 +69,7 @@ public class ExpressionVisitorTestCase {
}
@Test
- public void requireThatExpressionsArgumentsAreVisited() {
+ void requireThatExpressionsArgumentsAreVisited() {
final List<GroupingExpression> lst = new LinkedList<>();
GroupingExpression arg1 = new AttributeValue("arg1");
lst.add(arg1);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java
index 0e89f348449..d1ab7117677 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/GroupingOperationTestCase.java
@@ -3,11 +3,11 @@ package com.yahoo.search.grouping.request;
import com.yahoo.search.grouping.request.parser.ParseException;
import com.yahoo.search.grouping.request.parser.TokenMgrException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -15,7 +15,7 @@ import static org.junit.Assert.*;
public class GroupingOperationTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
GroupingOperation op = new AllOperation();
GroupingExpression exp = new AttributeValue("alias");
op.putAlias("alias", exp);
@@ -88,7 +88,7 @@ public class GroupingOperationTestCase {
}
@Test
- public void requireThatFromStringAsListParsesAllOperations() {
+ void requireThatFromStringAsListParsesAllOperations() {
List<GroupingOperation> lst = GroupingOperation.fromStringAsList("");
assertTrue(lst.isEmpty());
@@ -107,7 +107,7 @@ public class GroupingOperationTestCase {
}
@Test
- public void requireThatFromStringAcceptsOnlyOneOperation() {
+ void requireThatFromStringAcceptsOnlyOneOperation() {
try {
GroupingOperation.fromString("");
fail();
@@ -125,7 +125,7 @@ public class GroupingOperationTestCase {
}
@Test
- public void requireThatParseExceptionsAreRethrown() {
+ void requireThatParseExceptionsAreRethrown() {
try {
GroupingOperation.fromString("all(foo)");
fail();
@@ -136,7 +136,7 @@ public class GroupingOperationTestCase {
}
@Test
- public void requireThatTokenErrorsAreRethrown() {
+ void requireThatTokenErrorsAreRethrown() {
try {
GroupingOperation.fromString("all(\\foo)");
fail();
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 d22c2dee7b6..823993b6bc6 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
@@ -1,19 +1,17 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Einar M R Rosenvinge
*/
public class MathFunctionsTestCase {
-
+
@Test
- public void testMathFunctions() {
+ void testMathFunctions() {
//if this fails, update the count AND add a test in each of the two blocks below
assertEquals(21, MathFunctions.Function.values().length);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/request/MathResolverTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/request/MathResolverTestCase.java
index 734e2c6a0cb..39fdc7fc3a6 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/request/MathResolverTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/request/MathResolverTestCase.java
@@ -1,10 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author Simon Thoresen Hult
@@ -18,40 +18,40 @@ public class MathResolverTestCase {
// --------------------------------------------------------------------------------
@Test
- public void testOperators() {
+ void testOperators() {
MathResolver resolver = new MathResolver();
resolver.push(MathResolver.Type.ADD, new LongValue(1));
resolver.push(MathResolver.Type.ADD, new LongValue(2));
assertEquals("add(1, 2)",
- resolver.resolve().toString());
+ resolver.resolve().toString());
resolver = new MathResolver();
resolver.push(MathResolver.Type.ADD, new LongValue(1));
resolver.push(MathResolver.Type.SUB, new LongValue(2));
assertEquals("sub(1, 2)",
- resolver.resolve().toString());
+ resolver.resolve().toString());
resolver = new MathResolver();
resolver.push(MathResolver.Type.ADD, new LongValue(1));
resolver.push(MathResolver.Type.DIV, new LongValue(2));
assertEquals("div(1, 2)",
- resolver.resolve().toString());
+ resolver.resolve().toString());
resolver = new MathResolver();
resolver.push(MathResolver.Type.ADD, new LongValue(1));
resolver.push(MathResolver.Type.MOD, new LongValue(2));
assertEquals("mod(1, 2)",
- resolver.resolve().toString());
+ resolver.resolve().toString());
resolver = new MathResolver();
resolver.push(MathResolver.Type.ADD, new LongValue(1));
resolver.push(MathResolver.Type.MUL, new LongValue(2));
assertEquals("mul(1, 2)",
- resolver.resolve().toString());
+ resolver.resolve().toString());
}
@Test
- public void testOperatorPrecedence() {
+ void testOperatorPrecedence() {
assertResolve("add(add(1, 2), 3)", MathResolver.Type.ADD, MathResolver.Type.ADD);
assertResolve("add(1, sub(2, 3))", MathResolver.Type.ADD, MathResolver.Type.SUB);
assertResolve("add(1, div(2, 3))", MathResolver.Type.ADD, MathResolver.Type.DIV);
@@ -83,21 +83,21 @@ public class MathResolverTestCase {
assertResolve("mul(mul(1, 2), 3)", MathResolver.Type.MUL, MathResolver.Type.MUL);
assertResolve("add(1, sub(div(2, mod(3, mul(4, 5))), 6))",
- MathResolver.Type.ADD, MathResolver.Type.DIV, MathResolver.Type.MOD,
- MathResolver.Type.MUL, MathResolver.Type.SUB);
+ MathResolver.Type.ADD, MathResolver.Type.DIV, MathResolver.Type.MOD,
+ MathResolver.Type.MUL, MathResolver.Type.SUB);
assertResolve("add(sub(1, div(mod(mul(2, 3), 4), 5)), 6)",
- MathResolver.Type.SUB, MathResolver.Type.MUL, MathResolver.Type.MOD,
- MathResolver.Type.DIV, MathResolver.Type.ADD);
+ MathResolver.Type.SUB, MathResolver.Type.MUL, MathResolver.Type.MOD,
+ MathResolver.Type.DIV, MathResolver.Type.ADD);
assertResolve("add(1, sub(2, div(3, mod(4, mul(5, 6)))))",
- MathResolver.Type.ADD, MathResolver.Type.SUB, MathResolver.Type.DIV,
- MathResolver.Type.MOD, MathResolver.Type.MUL);
+ MathResolver.Type.ADD, MathResolver.Type.SUB, MathResolver.Type.DIV,
+ MathResolver.Type.MOD, MathResolver.Type.MUL);
assertResolve("add(sub(div(mod(mul(1, 2), 3), 4), 5), 6)",
- MathResolver.Type.MUL, MathResolver.Type.MOD, MathResolver.Type.DIV,
- MathResolver.Type.SUB, MathResolver.Type.ADD);
+ MathResolver.Type.MUL, MathResolver.Type.MOD, MathResolver.Type.DIV,
+ MathResolver.Type.SUB, MathResolver.Type.ADD);
}
@Test
- public void testOperatorSupport() {
+ void testOperatorSupport() {
MathResolver resolver = new MathResolver();
for (MathResolver.Type type : MathResolver.Type.values()) {
if (type == MathResolver.Type.ADD) {
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 dfa297b4fa6..03223f786e8 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
@@ -1,13 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Ulf Lilleengen
@@ -21,18 +21,18 @@ public class RawBufferTestCase {
// --------------------------------------------------------------------------------
@Test
- public void requireThatCompareWorks() {
+ void requireThatCompareWorks() {
RawBuffer buffer = new RawBuffer();
- buffer.put((byte)'a');
- buffer.put((byte)'b');
+ buffer.put((byte) 'a');
+ buffer.put((byte) 'b');
RawBuffer buffer2 = new RawBuffer();
- buffer2.put((byte)'k');
- buffer2.put((byte)'a');
+ buffer2.put((byte) 'k');
+ buffer2.put((byte) 'a');
ArrayList<Byte> backing = new ArrayList<>();
- backing.add((byte)'a');
- backing.add((byte)'b');
+ backing.add((byte) 'a');
+ backing.add((byte) 'b');
RawBuffer buffer3 = new RawBuffer(backing);
assertEquals(buffer.compareTo(buffer2), -1);
@@ -41,9 +41,9 @@ public class RawBufferTestCase {
}
@Test
- public void requireThatToStringWorks() {
+ void requireThatToStringWorks() {
assertToString(Arrays.asList("a".getBytes()[0], "b".getBytes()[0]), "{97,98}");
- assertToString(Arrays.asList((byte)2, (byte)6), "{2,6}");
+ assertToString(Arrays.asList((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 c02e46fae98..e2b4dc4f34b 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
@@ -1,11 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -13,7 +13,7 @@ import static org.junit.Assert.*;
public class RequestTestCase {
@Test
- public void requireThatApiWorks() {
+ void requireThatApiWorks() {
GroupingOperation op = new AllOperation()
.setGroupBy(new AttributeValue("foo"))
.addOrderBy(new CountAggregator())
@@ -22,19 +22,19 @@ public class RequestTestCase {
.addOutput(new CountAggregator())
.addOutput(new MinAggregator(new AttributeValue("bar")))
.addChild(new EachOperation()
- .addOutput(new AddFunction(
- new LongValue(69),
- new AttributeValue("baz")))
- .addOutput(new SummaryValue("cox"))));
+ .addOutput(new AddFunction(
+ new LongValue(69),
+ new AttributeValue("baz")))
+ .addOutput(new SummaryValue("cox"))));
assertEquals("all(group(foo) order(count()) all() each() " +
- "each(output(count(), min(bar)) each(output(add(69, baz), summary(cox)))))",
- op.toString());
+ "each(output(count(), min(bar)) each(output(add(69, baz), summary(cox)))))",
+ op.toString());
op.resolveLevel(1);
GroupingExpression exp = op.getGroupBy();
assertNotNull(exp);
assertTrue(exp instanceof AttributeValue);
- assertEquals("foo", ((AttributeValue)exp).getAttributeName());
+ assertEquals("foo", ((AttributeValue) exp).getAttributeName());
assertEquals(1, op.getNumOrderBy());
assertNotNull(exp = op.getOrderBy(0));
assertTrue(exp instanceof CountAggregator);
@@ -49,9 +49,9 @@ public class RequestTestCase {
assertTrue(exp instanceof CountAggregator);
assertNotNull(exp = op.getOutput(1));
assertTrue(exp instanceof MinAggregator);
- assertNotNull(exp = ((MinAggregator)exp).getExpression());
+ assertNotNull(exp = ((MinAggregator) exp).getExpression());
assertTrue(exp instanceof AttributeValue);
- assertEquals("bar", ((AttributeValue)exp).getAttributeName());
+ assertEquals("bar", ((AttributeValue) exp).getAttributeName());
assertEquals(1, op.getNumChildren());
assertNotNull(op = op.getChild(0));
@@ -59,24 +59,24 @@ public class RequestTestCase {
assertEquals(2, op.getNumOutputs());
assertNotNull(exp = op.getOutput(0));
assertTrue(exp instanceof AddFunction);
- assertEquals(2, ((AddFunction)exp).getNumArgs());
- GroupingExpression arg = ((AddFunction)exp).getArg(0);
+ assertEquals(2, ((AddFunction) exp).getNumArgs());
+ GroupingExpression arg = ((AddFunction) exp).getArg(0);
assertNotNull(arg);
assertTrue(arg instanceof LongValue);
- assertEquals(69L, ((LongValue)arg).getValue().longValue());
- assertNotNull(arg = ((AddFunction)exp).getArg(1));
+ assertEquals(69L, ((LongValue) arg).getValue().longValue());
+ assertNotNull(arg = ((AddFunction) exp).getArg(1));
assertTrue(arg instanceof AttributeValue);
- assertEquals("baz", ((AttributeValue)arg).getAttributeName());
+ assertEquals("baz", ((AttributeValue) arg).getAttributeName());
assertNotNull(exp = op.getOutput(1));
assertTrue(exp instanceof SummaryValue);
- assertEquals("cox", ((SummaryValue)exp).getSummaryName());
+ assertEquals("cox", ((SummaryValue) exp).getSummaryName());
}
@Test
- public void requireThatPredefinedApiWorks() {
+ void requireThatPredefinedApiWorks() {
PredefinedFunction fnc = new LongPredefined(new AttributeValue("foo"),
- new LongBucket(1, 2),
- new LongBucket(3, 4));
+ new LongBucket(1, 2),
+ new LongBucket(3, 4));
assertEquals(2, fnc.getNumBuckets());
BucketValue bucket = fnc.getBucket(0);
assertNotNull(bucket);
@@ -91,7 +91,7 @@ public class RequestTestCase {
}
@Test
- public void requireThatBucketIntegrityIsChecked() {
+ void requireThatBucketIntegrityIsChecked() {
try {
new LongBucket(2, 1);
} catch (IllegalArgumentException e) {
@@ -99,37 +99,37 @@ public class RequestTestCase {
}
try {
new LongPredefined(new AttributeValue("foo"),
- new LongBucket(3, 4),
- new LongBucket(1, 2));
+ new LongBucket(3, 4),
+ new LongBucket(1, 2));
} catch (IllegalArgumentException e) {
assertEquals("Buckets must be monotonically increasing, got bucket[3, 4> before bucket[1, 2>.",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void requireThatAliasWorks() {
+ void requireThatAliasWorks() {
GroupingOperation all = new AllOperation();
all.putAlias("myalias", new AttributeValue("foo"));
GroupingExpression exp = all.getAlias("myalias");
assertNotNull(exp);
assertTrue(exp instanceof AttributeValue);
- assertEquals("foo", ((AttributeValue)exp).getAttributeName());
+ assertEquals("foo", ((AttributeValue) exp).getAttributeName());
GroupingOperation each = new EachOperation();
all.addChild(each);
assertNotNull(exp = each.getAlias("myalias"));
assertTrue(exp instanceof AttributeValue);
- assertEquals("foo", ((AttributeValue)exp).getAttributeName());
+ assertEquals("foo", ((AttributeValue) exp).getAttributeName());
each.putAlias("myalias", new AttributeValue("bar"));
assertNotNull(exp = each.getAlias("myalias"));
assertTrue(exp instanceof AttributeValue);
- assertEquals("bar", ((AttributeValue)exp).getAttributeName());
+ assertEquals("bar", ((AttributeValue) exp).getAttributeName());
}
@Test
- public void testOrderBy() {
+ void testOrderBy() {
GroupingOperation all = new AllOperation();
all.addOrderBy(new AttributeValue("foo"));
try {
@@ -143,7 +143,7 @@ public class RequestTestCase {
}
@Test
- public void testMax() {
+ void testMax() {
GroupingOperation all = new AllOperation();
all.setMax(69);
try {
@@ -156,10 +156,10 @@ public class RequestTestCase {
}
@Test
- public void testAccuracy() {
+ void testAccuracy() {
GroupingOperation all = new AllOperation();
all.setAccuracy(0.53);
- assertEquals((long)(100.0 * all.getAccuracy()), 53);
+ assertEquals((long) (100.0 * all.getAccuracy()), 53);
try {
all.setAccuracy(1.2);
fail();
@@ -175,7 +175,7 @@ public class RequestTestCase {
}
@Test
- public void testLevelChange() {
+ void testLevelChange() {
GroupingOperation all = new AllOperation();
all.resolveLevel(0);
assertEquals(0, all.getLevel());
@@ -198,7 +198,7 @@ public class RequestTestCase {
}
@Test
- public void testLevelInheritance() {
+ void testLevelInheritance() {
GroupingOperation grandParent, parent, child, grandChild;
grandParent = new AllOperation()
.addChild(parent = new EachOperation()
@@ -213,7 +213,7 @@ public class RequestTestCase {
}
@Test
- public void testLevelPropagation() {
+ void testLevelPropagation() {
GroupingOperation all = new AllOperation()
.setGroupBy(new AttributeValue("foo"))
.addOrderBy(new MaxAggregator(new AttributeValue("bar")))
@@ -224,6 +224,6 @@ public class RequestTestCase {
assertEquals(0, all.getGroupBy().getLevel());
assertEquals(1, all.getOrderBy(0).getLevel());
assertEquals(1, all.getChild(0).getOutput(0).getLevel());
- assertEquals(0, ((AggregatorNode)all.getChild(0).getOutput(0)).getExpression().getLevel());
+ assertEquals(0, ((AggregatorNode) all.getChild(0).getOutput(0)).getExpression().getLevel());
}
}
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 56444a99ed3..c95451e991c 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
@@ -2,7 +2,7 @@
package com.yahoo.search.grouping.request.parser;
import com.yahoo.search.grouping.request.GroupingOperation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -26,7 +26,7 @@ public class GroupingParserBenchmarkTest {
}
@Test
- public void requireThatGroupingParserIsFast() {
+ void requireThatGroupingParserIsFast() {
List<String> inputs = getInputs();
long ignore = 0;
long now = 0;
@@ -39,9 +39,9 @@ public class GroupingParserBenchmarkTest {
}
}
long micros = TimeUnit.NANOSECONDS.toMicros(System.nanoTime() - now);
- System.out.format("%d \u03bcs (avg %.2f)\n", micros, (double)micros / (NUM_RUNS * inputs.size()));
+ System.out.format("%d \u03bcs (avg %.2f)\n", micros, (double) micros / (NUM_RUNS * inputs.size()));
for (Map.Entry<String, Long> entry : PREV_RESULTS.entrySet()) {
- System.out.format("%-20s : %4.2f\n", entry.getKey(), (double)micros / entry.getValue());
+ System.out.format("%-20s : %4.2f\n", entry.getKey(), (double) micros / entry.getValue());
}
System.out.println("\nignore " + ignore);
}
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 0dfd4685c0f..dd55dd46e5e 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
@@ -9,17 +9,13 @@ import com.yahoo.search.query.parser.Parsable;
import com.yahoo.search.query.parser.ParserEnvironment;
import com.yahoo.search.yql.VespaGroupingStep;
import com.yahoo.search.yql.YqlParser;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -27,7 +23,7 @@ import static org.junit.Assert.fail;
public class GroupingParserTestCase {
@Test
- public void requireThatMathAllowsWhitespace() {
+ void requireThatMathAllowsWhitespace() {
for (String op : Arrays.asList("+", " +", " + ", "+ ",
"-", " -", " - ", "- ",
"*", " *", " * ", "* ",
@@ -41,7 +37,7 @@ public class GroupingParserTestCase {
}
@Test
- public void testRequestList() {
+ void testRequestList() {
List<GroupingOperation> lst = GroupingOperation.fromStringAsList("all();each();all() where(true);each()");
assertNotNull(lst);
assertEquals(4, lst.size());
@@ -52,113 +48,113 @@ public class GroupingParserTestCase {
}
@Test
- public void testAttributeFunctions() {
+ void testAttributeFunctions() {
assertParse("all(group(foo) each(output(sum(attribute(bar)))))",
- "all(group(foo) each(output(sum(attribute(bar)))))");
+ "all(group(foo) each(output(sum(attribute(bar)))))");
assertParse("all(group(foo) each(output(sum(interpolatedlookup(bar, 0.25)))))",
- "all(group(foo) each(output(sum(interpolatedlookup(bar, 0.25)))))");
+ "all(group(foo) each(output(sum(interpolatedlookup(bar, 0.25)))))");
assertParse("all(group(foo) each(output(sum(array.at(bar, 42.0)))))",
- "all(group(foo) each(output(sum(array.at(bar, 42.0)))))");
+ "all(group(foo) each(output(sum(array.at(bar, 42.0)))))");
}
@Test
- public void requireThatTokenImagesAreNotReservedWords() {
+ void requireThatTokenImagesAreNotReservedWords() {
List<String> images = Arrays.asList("acos",
- "acosh",
- "accuracy",
- "add",
- "alias",
- "all",
- "and",
- "array",
- "as",
- "at",
- "asin",
- "asinh",
- "atan",
- "atanh",
- "attribute",
- "avg",
- "bucket",
- "cat",
- "cbrt",
- "cos",
- "cosh",
- "count",
- "debugwait",
- "div",
- "docidnsspecific",
- "each",
- "exp",
- "fixedwidth",
- "floor",
- "group",
- "hint",
- "hypot",
- "log",
- "log1p",
- "log10",
- "math",
- "max",
- "md5",
- "min",
- "mod",
- "mul",
- "neg",
- "normalizesubject",
- "now",
- "or",
- "order",
- "output",
- "pow",
- "precision",
- "predefined",
- "relevance",
- "reverse",
- "sin",
- "sinh",
- "size",
- "sort",
- "stddev",
- "interpolatedlookup",
- "sqrt",
- "strcat",
- "strlen",
- "sub",
- "sum",
- "summary",
- "tan",
- "tanh",
- "time",
- "date",
- "dayofmonth",
- "dayofweek",
- "dayofyear",
- "hourofday",
- "minuteofhour",
- "monthofyear",
- "secondofminute",
- "year",
- "todouble",
- "tolong",
- "toraw",
- "tostring",
- "true",
- "false",
- "uca",
- "where",
- "x",
- "xor",
- "xorbit",
- "y",
- "zcurve");
+ "acosh",
+ "accuracy",
+ "add",
+ "alias",
+ "all",
+ "and",
+ "array",
+ "as",
+ "at",
+ "asin",
+ "asinh",
+ "atan",
+ "atanh",
+ "attribute",
+ "avg",
+ "bucket",
+ "cat",
+ "cbrt",
+ "cos",
+ "cosh",
+ "count",
+ "debugwait",
+ "div",
+ "docidnsspecific",
+ "each",
+ "exp",
+ "fixedwidth",
+ "floor",
+ "group",
+ "hint",
+ "hypot",
+ "log",
+ "log1p",
+ "log10",
+ "math",
+ "max",
+ "md5",
+ "min",
+ "mod",
+ "mul",
+ "neg",
+ "normalizesubject",
+ "now",
+ "or",
+ "order",
+ "output",
+ "pow",
+ "precision",
+ "predefined",
+ "relevance",
+ "reverse",
+ "sin",
+ "sinh",
+ "size",
+ "sort",
+ "stddev",
+ "interpolatedlookup",
+ "sqrt",
+ "strcat",
+ "strlen",
+ "sub",
+ "sum",
+ "summary",
+ "tan",
+ "tanh",
+ "time",
+ "date",
+ "dayofmonth",
+ "dayofweek",
+ "dayofyear",
+ "hourofday",
+ "minuteofhour",
+ "monthofyear",
+ "secondofminute",
+ "year",
+ "todouble",
+ "tolong",
+ "toraw",
+ "tostring",
+ "true",
+ "false",
+ "uca",
+ "where",
+ "x",
+ "xor",
+ "xorbit",
+ "y",
+ "zcurve");
for (String image : images) {
assertParse("all(group(" + image + "))", "all(group(" + image + "))");
}
}
@Test
- public void testTokenizedWhitespace() {
+ void testTokenizedWhitespace() {
String expected = "all(group(foo) each(output(max(bar))))";
assertParse(" all(group(foo)each(output(max(bar))))", expected);
@@ -182,7 +178,7 @@ public class GroupingParserTestCase {
}
@Test
- public void testOperationTypes() {
+ void testOperationTypes() {
assertParse("all()");
assertParse("each()");
assertParse("all(each())");
@@ -193,21 +189,21 @@ public class GroupingParserTestCase {
assertParse("all(each() each())");
assertParse("each(all() all())");
assertIllegalArgument("each(all() each())",
- "Operation 'each()' can not operate on single hit.");
+ "Operation 'each()' can not operate on single hit.");
assertIllegalArgument("each(group(foo) all() each())",
- "Operation 'each(group(foo) all() each())' can not group single hit.");
+ "Operation 'each(group(foo) all() each())' can not group single hit.");
assertIllegalArgument("each(each() all())",
- "Operation 'each()' can not operate on single hit.");
+ "Operation 'each()' can not operate on single hit.");
assertIllegalArgument("each(group(foo) each() all())",
- "Operation 'each(group(foo) each() all())' can not group single hit.");
+ "Operation 'each(group(foo) each() all())' can not group single hit.");
assertIllegalArgument("each(each() each())",
- "Operation 'each()' can not operate on single hit.");
+ "Operation 'each()' can not operate on single hit.");
assertIllegalArgument("each(group(foo) each() each())",
- "Operation 'each(group(foo) each() each())' can not group single hit.");
+ "Operation 'each(group(foo) each() each())' can not group single hit.");
}
@Test
- public void testOperationParts() {
+ void testOperationParts() {
assertParse("all(group(foo))");
assertParse("all(hint(foo))");
assertParse("all(hint(foo) hint(bar))");
@@ -232,7 +228,7 @@ public class GroupingParserTestCase {
}
@Test
- public void testComplexExpressionTypes() {
+ void testComplexExpressionTypes() {
// fixedwidth
assertParse("all(group(fixedwidth(foo, 1)))");
assertParse("all(group(fixedwidth(foo, 1.2)))");
@@ -315,43 +311,43 @@ public class GroupingParserTestCase {
assertParse("all(group(predefined(foo, bucket({'b', 'a'}, {'k', 'a'}), bucket({'k', 'a'}, {'u', 'b'}))))");
assertIllegalArgument("all(group(predefined(foo, bucket(1, 2.0))))",
- "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket(1, '2'))))",
- "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket(1, 2), bucket(3.0, 4.0))))",
- "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'DoubleValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket(1, 2), bucket('3', '4'))))",
- "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket(1, 2), bucket(\"3\", \"4\"))))",
- "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket(1, 2), bucket(three, four))))",
- "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
+ "Bucket type mismatch, expected 'LongValue' got 'StringValue'.");
assertIllegalArgument("all(group(predefined(foo, bucket<-inf, inf>)))",
- "Bucket type mismatch, cannot both be infinity");
+ "Bucket type mismatch, cannot both be infinity");
assertIllegalArgument("all(group(predefined(foo, bucket<inf, -inf>)))",
- "Encountered \" \"inf\" \"inf\"\" at line 1, column 34.");
+ "Encountered \" \"inf\" \"inf\"\" at line 1, column 34.");
assertIllegalArgument("all(group(predefined(foo, bucket(2, 1))))",
- "Bucket to-value can not be less than from-value.");
+ "Bucket to-value can not be less than from-value.");
assertIllegalArgument("all(group(predefined(foo, bucket(3, 4), bucket(1, 2))))",
- "Buckets must be monotonically increasing, got bucket[3, 4> before bucket[1, 2>.");
+ "Buckets must be monotonically increasing, got bucket[3, 4> before bucket[1, 2>.");
assertIllegalArgument("all(group(predefined(foo, bucket(b, a))))",
- "Bucket to-value can not be less than from-value.");
+ "Bucket to-value can not be less than from-value.");
assertIllegalArgument("all(group(predefined(foo, bucket(b, -inf))))",
- "Encountered \" \"-inf\" \"-inf\"\" at line 1, column 37.");
+ "Encountered \" \"-inf\" \"-inf\"\" at line 1, column 37.");
assertIllegalArgument("all(group(predefined(foo, bucket(c, d), bucket(a, b))))",
- "Buckets must be monotonically increasing, got bucket[\"c\", \"d\"> before bucket[\"a\", \"b\">.");
+ "Buckets must be monotonically increasing, got bucket[\"c\", \"d\"> before bucket[\"a\", \"b\">.");
assertIllegalArgument("all(group(predefined(foo, bucket(c, d), bucket(-inf, e))))",
- "Buckets must be monotonically increasing, got bucket[\"c\", \"d\"> before bucket[-inf, \"e\">.");
+ "Buckets must be monotonically increasing, got bucket[\"c\", \"d\"> before bucket[-inf, \"e\">.");
assertIllegalArgument("all(group(predefined(foo, bucket(u, inf), bucket(e, i))))",
- "Buckets must be monotonically increasing, got bucket[\"u\", inf> before bucket[\"e\", \"i\">.");
+ "Buckets must be monotonically increasing, got bucket[\"u\", inf> before bucket[\"e\", \"i\">.");
// xorbit
assertParse("all(group(xorbit(foo, 1)))");
}
@Test
- public void testInfixArithmetic() {
+ void testInfixArithmetic() {
assertParse("all(group(1))", "all(group(1))");
assertParse("all(group(1+2))", "all(group(add(1, 2)))");
assertParse("all(group(1-2))", "all(group(sub(1, 2)))");
@@ -371,16 +367,16 @@ public class GroupingParserTestCase {
}
@Test
- public void testOperationLabel() {
+ void testOperationLabel() {
assertParse("each() as(foo)",
- "each() as(foo)");
+ "each() as(foo)");
assertParse("all(each() as(foo)" +
- " each() as(bar))",
- "all(each() as(foo) each() as(bar))");
+ " each() as(bar))",
+ "all(each() as(foo) each() as(bar))");
assertParse("all(group(a) each(each() as(foo)" +
- " each() as(bar))" +
- " each() as(baz))",
- "all(group(a) each(each() as(foo) each() as(bar)) each() as(baz))");
+ " each() as(bar))" +
+ " each() as(baz))",
+ "all(group(a) each(each() as(foo) each() as(bar)) each() as(baz))");
assertIllegalArgument("all() as(foo)", "Encountered \" \"as\" \"as\"\" at line 1, column 7.");
assertIllegalArgument("all(all() as(foo))", "Encountered \" \"as\" \"as\"\" at line 1, column 11.");
@@ -388,58 +384,58 @@ public class GroupingParserTestCase {
}
@Test
- public void testAttributeName() {
+ void testAttributeName() {
assertParse("all(group(foo))");
assertIllegalArgument("all(group(foo.))",
- "Encountered \" \")\" \")\"\" at line 1, column 15.");
+ "Encountered \" \")\" \")\"\" at line 1, column 15.");
assertParse("all(group(foo.bar))");
assertIllegalArgument("all(group(foo.bar.))",
- "Encountered \" \")\" \")\"\" at line 1, column 19.");
+ "Encountered \" \")\" \")\"\" at line 1, column 19.");
assertParse("all(group(foo.bar.baz))");
}
@Test
- public void testOutputLabel() {
+ void testOutputLabel() {
assertParse("all(output(min(a) as(foo)))",
- "all(output(min(a) as(foo)))");
+ "all(output(min(a) as(foo)))");
assertParse("all(output(min(a) as(foo), max(b) as(bar)))",
- "all(output(min(a) as(foo), max(b) as(bar)))");
+ "all(output(min(a) as(foo), max(b) as(bar)))");
assertIllegalArgument("all(output(min(a)) as(foo))",
- "Encountered \" \"as\" \"as\"\" at line 1, column 20.");
+ "Encountered \" \"as\" \"as\"\" at line 1, column 20.");
}
@Test
- public void testRootWhere() {
+ void testRootWhere() {
String expected = "all(where(bar) all(group(foo)))";
assertParse("all(where(bar) all(group(foo)))", expected);
assertParse("all(group(foo)) where(bar)", expected);
}
@Test
- public void testParseBadRequest() {
+ void testParseBadRequest() {
assertIllegalArgument("output(count())",
- "Encountered \" \"output\" \"output\"\" at line 1, column 1.");
+ "Encountered \" \"output\" \"output\"\" at line 1, column 1.");
assertIllegalArgument("each(output(count()))",
- "Expression 'count()' not applicable for single hit.");
+ "Expression 'count()' not applicable for single hit.");
assertIllegalArgument("all(output(count())))",
- "Encountered \" \")\" \")\"\" at line 1, column 21.");
+ "Encountered \" \")\" \")\"\" at line 1, column 21.");
}
@Test
- public void testAttributeFunction() {
+ void testAttributeFunction() {
assertParse("all(group(attribute(foo)))");
assertParse("all(group(attribute(foo)) order(sum(attribute(a))))");
}
@Test
- public void testAccuracy() {
+ void testAccuracy() {
assertParse("all(accuracy(0.5))");
assertParse("all(group(foo) accuracy(1.0))");
}
@Test
- public void testMapSyntax() {
+ void testMapSyntax() {
assertParse("all(group(my.little{key}))", "all(group(my.little{\"key\"}))");
assertParse("all(group(my.little{key }))", "all(group(my.little{\"key\"}))");
assertParse("all(group(my.little{\"key\"}))", "all(group(my.little{\"key\"}))");
@@ -458,7 +454,7 @@ public class GroupingParserTestCase {
}
@Test
- public void testMapSyntaxWithKeySourceAttribute() {
+ void testMapSyntaxWithKeySourceAttribute() {
assertAttributeMapLookup("all(group(my_map{attribute(my_attr)}))",
"my_map.key", "my_map.value", "", "my_attr");
assertAttributeMapLookup("all(group(my_map{attribute(my_attr)}.name))",
@@ -487,7 +483,7 @@ public class GroupingParserTestCase {
}
@Test
- public void testMisc() {
+ void testMisc() {
for (String fnc : Arrays.asList("time.date",
"time.dayofmonth",
"time.dayofweek",
@@ -536,39 +532,39 @@ public class GroupingParserTestCase {
// TODO: assertParseRequest("all(group(a) each(output(xor(xorbit(b)) xor(xorbit(b, 64)))))");
assertParse("all(group(artist) each(each(output(summary()))))");
assertParse("all(group(artist) max(13) each(group(fixedwidth(year, 21.34)) max(55) output(count()) " +
- "each(each(output(summary())))))");
+ "each(each(output(summary())))))");
assertParse("all(group(artist) max(13) each(group(predefined(year, bucket(7, 19), bucket(90, 300))) " +
- "max(55) output(count()) each(each(output(summary())))))");
+ "max(55) output(count()) each(each(output(summary())))))");
assertParse("all(group(artist) max(13) each(group(predefined(year, bucket(7.1, 19.0), bucket(90.7, 300.0))) " +
- "max(55) output(count()) each(each(output(summary())))))");
+ "max(55) output(count()) each(each(output(summary())))))");
assertParse("all(group(artist) max(13) each(group(predefined(year, bucket('a', 'b'), bucket('cd'))) " +
- "max(55) output(count()) each(each(output(summary())))))");
+ "max(55) output(count()) each(each(output(summary())))))");
assertParse("all(output(count()))");
assertParse("all(group(album) output(count()))");
assertParse("all(group(album) each(output(count())))");
assertParse("all(group(artist) each(group(album) output(count()))" +
- " each(group(song) output(count())))");
+ " each(group(song) output(count())))");
assertParse("all(group(artist) output(count())" +
- " each(group(album) output(count())" +
- " each(group(song) output(count())" +
- " each(each(output(summary()))))))");
+ " each(group(album) output(count())" +
+ " each(group(song) output(count())" +
+ " each(each(output(summary()))))))");
assertParse("all(group(album) order(-$total=sum(length)) each(output($total)))");
assertParse("all(group(album) max(1) each(output(sum(length))))");
assertParse("all(group(artist) each(max(2) each(output(summary()))))");
assertParse("all(group(artist) max(3)" +
- " each(group(album as(albumsongs)) each(each(output(summary()))))" +
- " each(group(album as(albumlength)) output(sum(sum(length)))))");
+ " each(group(album as(albumsongs)) each(each(output(summary()))))" +
+ " each(group(album as(albumlength)) output(sum(sum(length)))))");
assertParse("all(group(artist) max(15)" +
- " each(group(album) " +
- " each(group(song)" +
- " each(max(2) each(output(summary()))))))");
+ " each(group(album) " +
+ " each(group(song)" +
+ " each(max(2) each(output(summary()))))))");
assertParse("all(group(artist) max(15)" +
- " each(group(album)" +
- " each(group(song)" +
- " each(max(2) each(output(summary())))))" +
- " each(group(song) max(5) order(sum(popularity))" +
- " each(output(sum(sold)) each(output(summary())))))");
+ " each(group(album)" +
+ " each(group(song)" +
+ " each(max(2) each(output(summary())))))" +
+ " each(group(song) max(5) order(sum(popularity))" +
+ " each(output(sum(sold)) each(output(summary())))))");
assertParse("all(group(artist) order(max(relevance) * count()) each(output(count())))");
assertParse("all(group(artist) each(output(sum(popularity) / count())))");
@@ -576,9 +572,9 @@ public class GroupingParserTestCase {
assertParse("all(group(debugwait(artist, 3.3, true)))");
assertParse("all(group(debugwait(artist, 3.3, false)))");
assertIllegalArgument("all(group(debugwait(artist, -3.3, true)))",
- "Encountered \" \"-\" \"-\"\" at line 1, column 29");
+ "Encountered \" \"-\" \"-\"\" at line 1, column 29");
assertIllegalArgument("all(group(debugwait(artist, 3.3, lol)))",
- "Encountered \" <IDENTIFIER> \"lol\"\" at line 1, column 34");
+ "Encountered \" <IDENTIFIER> \"lol\"\" at line 1, column 34");
assertParse("all(group(artist) each(output(stddev(simple))))");
// Test max()
@@ -588,35 +584,35 @@ public class GroupingParserTestCase {
}
@Test
- public void testBucket() {
+ void testBucket() {
List<GroupingOperation> operations = assertParse("all(group(predefined(artist, bucket('a'), bucket('c', 'z'))))");
assertEquals(1, operations.size());
assertEquals("all(group(predefined(artist, bucket[\"a\", \"a \">, bucket[\"c\", \"z\">)))",
- operations.get(0).toString());
+ operations.get(0).toString());
}
@Test
- public void requireThatParseExceptionMessagesContainErrorMarker() {
+ void requireThatParseExceptionMessagesContainErrorMarker() {
assertIllegalArgument("foo",
- "Encountered \" <IDENTIFIER> \"foo\"\" at line 1, column 1.\n\n" +
- "Was expecting one of:\n\n" +
- "<SPACE> ...\n" +
- " \"all\" ...\n" +
- " \"each\" ...\n" +
- " \n" +
- "At position:\n" +
- "foo\n" +
- "^");
+ "Encountered \" <IDENTIFIER> \"foo\"\" at line 1, column 1.\n\n" +
+ "Was expecting one of:\n\n" +
+ "<SPACE> ...\n" +
+ " \"all\" ...\n" +
+ " \"each\" ...\n" +
+ " \n" +
+ "At position:\n" +
+ "foo\n" +
+ "^");
assertIllegalArgument("\n foo",
- "Encountered \" <IDENTIFIER> \"foo\"\" at line 2, column 2.\n\n" +
- "Was expecting one of:\n\n" +
- "<SPACE> ...\n" +
- " \"all\" ...\n" +
- " \"each\" ...\n" +
- " \n" +
- "At position:\n" +
- " foo\n" +
- " ^");
+ "Encountered \" <IDENTIFIER> \"foo\"\" at line 2, column 2.\n\n" +
+ "Was expecting one of:\n\n" +
+ "<SPACE> ...\n" +
+ " \"all\" ...\n" +
+ " \"each\" ...\n" +
+ " \n" +
+ "At position:\n" +
+ " foo\n" +
+ " ^");
}
// --------------------------------------------------------------------------------
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 c97bf150645..3e1cff54737 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
@@ -23,15 +23,15 @@ import com.yahoo.searchlib.aggregation.Grouping;
import com.yahoo.searchlib.aggregation.HitsAggregationResult;
import com.yahoo.searchlib.aggregation.hll.SparseSketch;
import com.yahoo.searchlib.expression.StringResultNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author bratseth
@@ -39,42 +39,42 @@ import static org.junit.Assert.assertTrue;
public class FlatteningSearcherTestCase {
@Test
- public void testFlatteningSearcher() {
+ void testFlatteningSearcher() {
Query query = new Query("?query=test");
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) output(count()) each(each(output(summary(bar)))))"));
Grouping group0 = new Grouping(0);
group0.setRoot(new Group()
- .addAggregationResult(new ExpressionCountAggregationResult(new SparseSketch(), sketch -> 69))
- .addChild(new Group().setId(new StringResultNode("unique1"))
- .addAggregationResult(new HitsAggregationResult(3, "bar")
- )
- )
- .addChild(new Group().setId(new StringResultNode("unique2"))
- .addAggregationResult(new HitsAggregationResult(3, "bar")
- )
- ));
+ .addAggregationResult(new ExpressionCountAggregationResult(new SparseSketch(), sketch -> 69))
+ .addChild(new Group().setId(new StringResultNode("unique1"))
+ .addAggregationResult(new HitsAggregationResult(3, "bar")
+ )
+ )
+ .addChild(new Group().setId(new StringResultNode("unique2"))
+ .addAggregationResult(new HitsAggregationResult(3, "bar")
+ )
+ ));
Grouping group1 = new Grouping(0);
group1.setRoot(new Group()
- .addChild(new Group().setId(new StringResultNode("unique1"))
- .addAggregationResult(new HitsAggregationResult(3, "bar")
- .addHit(fs4Hit(0.7))
- .addHit(fs4Hit(0.6))
- .addHit(fs4Hit(0.3))
- )
- )
- .addChild(new Group().setId(new StringResultNode("unique2"))
- .addAggregationResult(new HitsAggregationResult(3, "bar")
- .addHit(fs4Hit(0.5))
- .addHit(fs4Hit(0.4))
- )
- ));
+ .addChild(new Group().setId(new StringResultNode("unique1"))
+ .addAggregationResult(new HitsAggregationResult(3, "bar")
+ .addHit(fs4Hit(0.7))
+ .addHit(fs4Hit(0.6))
+ .addHit(fs4Hit(0.3))
+ )
+ )
+ .addChild(new Group().setId(new StringResultNode("unique2"))
+ .addAggregationResult(new HitsAggregationResult(3, "bar")
+ .addHit(fs4Hit(0.5))
+ .addHit(fs4Hit(0.4))
+ )
+ ));
Execution execution = newExecution(new FlatteningSearcher(),
- new GroupingExecutor(ComponentId.fromString("grouping")),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(group0), null),
- new GroupingListHit(List.of(group1), null))));
+ new GroupingExecutor(ComponentId.fromString("grouping")),
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(group0), null),
+ new GroupingListHit(List.of(group1), null))));
Result result = execution.search(query);
assertEquals(5, result.hits().size());
assertFlat(result);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
index 01eba55924f..7b2f0d52742 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
@@ -1,9 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -11,7 +11,7 @@ import static org.junit.Assert.*;
public class GroupIdTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
ValueGroupId valueId = new DoubleId(6.9);
assertEquals(6.9, valueId.getValue());
BucketGroupId rangeId = new DoubleBucketId(6.0, 9.0);
@@ -24,11 +24,11 @@ public class GroupIdTestCase {
assertEquals(6L, rangeId.getFrom());
assertEquals(9L, rangeId.getTo());
- valueId = new RawId(new byte[] { 6, 9 });
- assertArrayEquals(new byte[] { 6, 9 }, (byte[])valueId.getValue());
- rangeId = new RawBucketId(new byte[] { 6, 9 }, new byte[] { 9, 6 });
- assertArrayEquals(new byte[] { 6, 9 }, (byte[])rangeId.getFrom());
- assertArrayEquals(new byte[] { 9, 6 }, (byte[])rangeId.getTo());
+ valueId = new RawId(new byte[]{6, 9});
+ assertArrayEquals(new byte[]{6, 9}, (byte[]) valueId.getValue());
+ rangeId = new RawBucketId(new byte[]{6, 9}, new byte[]{9, 6});
+ assertArrayEquals(new byte[]{6, 9}, (byte[]) rangeId.getFrom());
+ assertArrayEquals(new byte[]{9, 6}, (byte[]) rangeId.getTo());
valueId = new StringId("69");
assertEquals("69", valueId.getValue());
@@ -41,14 +41,14 @@ public class GroupIdTestCase {
}
@Test
- public void requireThatToStringCorrespondsToType() {
+ void requireThatToStringCorrespondsToType() {
assertEquals("group:double:6.9", new DoubleId(6.9).toString());
assertEquals("group:double_bucket:6.0:9.0", new DoubleBucketId(6.0, 9.0).toString());
assertEquals("group:long:69", new LongId(69L).toString());
assertEquals("group:long_bucket:6:9", new LongBucketId(6L, 9L).toString());
assertEquals("group:null", new NullId().toString());
- assertEquals("group:raw:[6, 9]", new RawId(new byte[] { 6, 9 }).toString());
- assertEquals("group:raw_bucket:[6, 9]:[9, 6]", new RawBucketId(new byte[] { 6, 9 }, new byte[] { 9, 6 }).toString());
+ assertEquals("group:raw:[6, 9]", new RawId(new byte[]{6, 9}).toString());
+ assertEquals("group:raw_bucket:[6, 9]:[9, 6]", new RawBucketId(new byte[]{6, 9}, new byte[]{9, 6}).toString());
assertTrue(new RootId(0).toString().startsWith("group:root:"));
assertEquals("group:string:69", new StringId("69").toString());
assertEquals("group:string_bucket:6:9", new StringBucketId("6", "9").toString());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
index 33e8f119ec9..3c583c88d5a 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
@@ -2,10 +2,10 @@
package com.yahoo.search.grouping.result;
import com.yahoo.search.grouping.Continuation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* @author Simon Thoresen Hult
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertSame;
public class GroupListTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
GroupList lst = new GroupList("foo");
assertEquals("foo", lst.getLabel());
assertEquals(0, lst.continuations().size());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
index 47f82205689..4e359531b7a 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
@@ -3,10 +3,10 @@ package com.yahoo.search.grouping.result;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.Relevance;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* @author Simon Thoresen Hult
@@ -14,7 +14,7 @@ import static org.junit.Assert.assertNull;
public class GroupTestCase {
@Test
- public void requireThatListsAreAccessibleByLabel() {
+ void requireThatListsAreAccessibleByLabel() {
Group grp = new Group(new LongId(69L), new Relevance(1));
grp.add(new Hit("hit"));
grp.add(new HitList("hitList"));
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
index 2404af09c7a..5f1d2d3f125 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
@@ -2,10 +2,10 @@
package com.yahoo.search.grouping.result;
import com.yahoo.search.grouping.Continuation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
/**
* @author Simon Thoresen Hult
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertSame;
public class HitListTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
HitList lst = new HitList("foo");
assertEquals("foo", lst.getLabel());
assertEquals(0, lst.continuations().size());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
index 1035c9d9284..8e98f49df48 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
@@ -6,13 +6,13 @@ import com.yahoo.search.result.HitGroup;
import com.yahoo.search.result.Relevance;
import com.yahoo.text.Utf8;
import com.yahoo.text.XMLWriter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -20,7 +20,7 @@ import static org.junit.Assert.fail;
public class HitRendererTestCase {
@Test
- public void requireThatGroupListsRenderAsExpected() {
+ void requireThatGroupListsRenderAsExpected() {
assertRender(new GroupList("foo"), "<grouplist label=\"foo\"></grouplist>\n");
assertRender(new GroupList("b\u00e6z"), "<grouplist label=\"b\u00e6z\"></grouplist>\n");
@@ -28,21 +28,21 @@ public class HitRendererTestCase {
lst.continuations().put("bar.key", new MyContinuation("bar.val"));
lst.continuations().put("baz.key", new MyContinuation("baz.val"));
assertRender(lst, "<grouplist label=\"foo\">\n" +
- "<continuation id=\"bar.key\">bar.val</continuation>\n" +
- "<continuation id=\"baz.key\">baz.val</continuation>\n" +
- "</grouplist>\n");
+ "<continuation id=\"bar.key\">bar.val</continuation>\n" +
+ "<continuation id=\"baz.key\">baz.val</continuation>\n" +
+ "</grouplist>\n");
}
@Test
- public void requireThatGroupIdsRenderAsExpected() {
+ void requireThatGroupIdsRenderAsExpected() {
assertRender(newGroup(new DoubleId(6.9)),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"double\">6.9</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"double\">6.9</id>\n" +
+ "</group>\n");
assertRender(newGroup(new LongId(69L)),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"long\">69</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"long\">69</id>\n" +
+ "</group>\n");
assertRender(newGroup(new BoolId(true)),
"<group relevance=\"1.0\">\n" +
"<id type=\"bool\">true</id>\n" +
@@ -52,89 +52,89 @@ public class HitRendererTestCase {
"<id type=\"bool\">false</id>\n" +
"</group>\n");
assertRender(newGroup(new NullId()),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"null\"/>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"null\"/>\n" +
+ "</group>\n");
assertRender(newGroup(new RawId(Utf8.toBytes("foo"))),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"raw\">[102, 111, 111]</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"raw\">[102, 111, 111]</id>\n" +
+ "</group>\n");
assertRender(newGroup(new StringId("foo")),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"string\">foo</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"string\">foo</id>\n" +
+ "</group>\n");
assertRender(newGroup(new StringId("b\u00e6z")),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"string\">b\u00e6z</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"string\">b\u00e6z</id>\n" +
+ "</group>\n");
assertRender(newGroup(new DoubleBucketId(6.9, 9.6)),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"double_bucket\">\n<from>6.9</from>\n<to>9.6</to>\n</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"double_bucket\">\n<from>6.9</from>\n<to>9.6</to>\n</id>\n" +
+ "</group>\n");
assertRender(newGroup(new LongBucketId(6L, 9L)),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"long_bucket\">\n<from>6</from>\n<to>9</to>\n</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"long_bucket\">\n<from>6</from>\n<to>9</to>\n</id>\n" +
+ "</group>\n");
assertRender(newGroup(new StringBucketId("bar", "baz")),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"string_bucket\">\n<from>bar</from>\n<to>baz</to>\n</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"string_bucket\">\n<from>bar</from>\n<to>baz</to>\n</id>\n" +
+ "</group>\n");
assertRender(newGroup(new StringBucketId("b\u00e6r", "b\u00e6z")),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"string_bucket\">\n<from>b\u00e6r</from>\n<to>b\u00e6z</to>\n</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"string_bucket\">\n<from>b\u00e6r</from>\n<to>b\u00e6z</to>\n</id>\n" +
+ "</group>\n");
assertRender(newGroup(new RawBucketId(Utf8.toBytes("bar"), Utf8.toBytes("baz"))),
- "<group relevance=\"1.0\">\n" +
- "<id type=\"raw_bucket\">\n<from>[98, 97, 114]</from>\n<to>[98, 97, 122]</to>\n</id>\n" +
- "</group>\n");
+ "<group relevance=\"1.0\">\n" +
+ "<id type=\"raw_bucket\">\n<from>[98, 97, 114]</from>\n<to>[98, 97, 122]</to>\n</id>\n" +
+ "</group>\n");
}
@Test
- public void requireThatGroupsRenderAsExpected() {
+ void requireThatGroupsRenderAsExpected() {
Group group = newGroup(new StringId("foo"));
group.setField("foo", "bar");
group.setField("baz", "cox");
assertRender(group, "<group relevance=\"1.0\">\n" +
- "<id type=\"string\">foo</id>\n" +
- "<output label=\"foo\">bar</output>\n" +
- "<output label=\"baz\">cox</output>\n" +
- "</group>\n");
+ "<id type=\"string\">foo</id>\n" +
+ "<output label=\"foo\">bar</output>\n" +
+ "<output label=\"baz\">cox</output>\n" +
+ "</group>\n");
group = newGroup(new StringId("foo"));
group.setField("foo", "b\u00e6r");
group.setField("b\u00e5z", "cox");
assertRender(group, "<group relevance=\"1.0\">\n" +
- "<id type=\"string\">foo</id>\n" +
- "<output label=\"foo\">b\u00e6r</output>\n" +
- "<output label=\"b\u00e5z\">cox</output>\n" +
- "</group>\n");
+ "<id type=\"string\">foo</id>\n" +
+ "<output label=\"foo\">b\u00e6r</output>\n" +
+ "<output label=\"b\u00e5z\">cox</output>\n" +
+ "</group>\n");
}
@Test
- public void requireThatRootGroupsRenderAsExpected() {
+ void requireThatRootGroupsRenderAsExpected() {
RootGroup group = new RootGroup(0, new MyContinuation("69"));
group.setField("foo", "bar");
group.setField("baz", "cox");
assertRender(group, "<group relevance=\"1.0\">\n" +
- "<id type=\"root\"/>\n" +
- "<continuation id=\"this\">69</continuation>\n" +
- "<output label=\"foo\">bar</output>\n" +
- "<output label=\"baz\">cox</output>\n" +
- "</group>\n");
+ "<id type=\"root\"/>\n" +
+ "<continuation id=\"this\">69</continuation>\n" +
+ "<output label=\"foo\">bar</output>\n" +
+ "<output label=\"baz\">cox</output>\n" +
+ "</group>\n");
group = new RootGroup(0, new MyContinuation("96"));
group.setField("foo", "b\u00e6r");
group.setField("b\u00e5z", "cox");
assertRender(group, "<group relevance=\"1.0\">\n" +
- "<id type=\"root\"/>\n" +
- "<continuation id=\"this\">96</continuation>\n" +
- "<output label=\"foo\">b\u00e6r</output>\n" +
- "<output label=\"b\u00e5z\">cox</output>\n" +
- "</group>\n");
+ "<id type=\"root\"/>\n" +
+ "<continuation id=\"this\">96</continuation>\n" +
+ "<output label=\"foo\">b\u00e6r</output>\n" +
+ "<output label=\"b\u00e5z\">cox</output>\n" +
+ "</group>\n");
}
@Test
- public void requireThatHitListsRenderAsExpected() {
+ void requireThatHitListsRenderAsExpected() {
assertRender(new HitList("foo"), "<hitlist label=\"foo\"></hitlist>\n");
assertRender(new HitList("b\u00e6z"), "<hitlist label=\"b\u00e6z\"></hitlist>\n");
@@ -142,10 +142,10 @@ public class HitRendererTestCase {
lst.continuations().put("bar.key", new MyContinuation("bar.val"));
lst.continuations().put("baz.key", new MyContinuation("baz.val"));
assertRender(lst, "<hitlist label=\"foo\">\n" +
- "<continuation id=\"bar.key\">bar.val</continuation>\n" +
- "<continuation id=\"baz.key\">baz.val</continuation>\n" +
- "</hitlist>\n");
-}
+ "<continuation id=\"bar.key\">bar.val</continuation>\n" +
+ "<continuation id=\"baz.key\">baz.val</continuation>\n" +
+ "</hitlist>\n");
+ }
private static Group newGroup(GroupId id) {
return new Group(id, new Relevance(1));
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/CompositeContinuationTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/CompositeContinuationTestCase.java
index a440fcaac7a..ee177709b59 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/CompositeContinuationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/CompositeContinuationTestCase.java
@@ -2,11 +2,11 @@
package com.yahoo.search.grouping.vespa;
import com.yahoo.search.grouping.Continuation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Iterator;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -14,7 +14,7 @@ import static org.junit.Assert.*;
public class CompositeContinuationTestCase {
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
CompositeContinuation cnt = new CompositeContinuation();
Iterator<EncodableContinuation> it = cnt.iterator();
assertFalse(it.hasNext());
@@ -37,51 +37,51 @@ public class CompositeContinuationTestCase {
}
@Test
- public void requireThatCompositeContinuationsAreFlattened() {
+ void requireThatCompositeContinuationsAreFlattened() {
assertEncode("BCBCBCBEBGBCBKCBACBKCCK",
- newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
+ newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
assertEncode("BCBBBBBDBFBCBJBPCBJCCJ",
- newComposite(newComposite(newOffset(-1, -1, -2, -3)), newComposite(newOffset(-5, -8, -13, -21))));
+ newComposite(newComposite(newOffset(-1, -1, -2, -3)), newComposite(newOffset(-5, -8, -13, -21))));
}
@Test
- public void requireThatEmptyStringCanBeDecoded() {
+ void requireThatEmptyStringCanBeDecoded() {
assertDecode("", new CompositeContinuation());
}
@Test
- public void requireThatCompositeContinuationsCanBeDecoded() {
+ void requireThatCompositeContinuationsCanBeDecoded() {
assertDecode("BCBCBCBEBGBCBKCBACBKCCK",
- newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
+ newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
assertDecode("BCBBBBBDBFBCBJBPCBJCCJ",
- newComposite(newOffset(-1, -1, -2, -3), newOffset(-5, -8, -13, -21)));
+ newComposite(newOffset(-1, -1, -2, -3), newOffset(-5, -8, -13, -21)));
}
@Test
- public void requireThatHashCodeIsImplemented() {
+ void requireThatHashCodeIsImplemented() {
assertEquals(newComposite().hashCode(), newComposite().hashCode());
}
@Test
- public void requireThatEqualsIsImplemented() {
+ void requireThatEqualsIsImplemented() {
CompositeContinuation cnt = newComposite();
- assertFalse(cnt.equals(new Object()));
+ assertNotEquals(cnt, new Object());
assertEquals(cnt, newComposite());
- assertFalse(cnt.equals(newComposite(newOffset(1, 1, 2, 3))));
- assertFalse(cnt.equals(newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21))));
- assertFalse(cnt.equals(newComposite(newOffset(5, 8, 13, 21))));
+ assertNotEquals(cnt, newComposite(newOffset(1, 1, 2, 3)));
+ assertNotEquals(cnt, newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
+ assertNotEquals(cnt, newComposite(newOffset(5, 8, 13, 21)));
cnt = newComposite(newOffset(1, 1, 2, 3));
- assertFalse(cnt.equals(new Object()));
+ assertNotEquals(cnt, new Object());
assertEquals(cnt, newComposite(newOffset(1, 1, 2, 3)));
- assertFalse(cnt.equals(newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21))));
- assertFalse(cnt.equals(newComposite(newOffset(5, 8, 13, 21))));
+ assertNotEquals(cnt, newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
+ assertNotEquals(cnt, newComposite(newOffset(5, 8, 13, 21)));
cnt = newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21));
- assertFalse(cnt.equals(new Object()));
- assertFalse(cnt.equals(newComposite(newOffset(1, 1, 2, 3))));
+ assertNotEquals(cnt, new Object());
+ assertNotEquals(cnt, newComposite(newOffset(1, 1, 2, 3)));
assertEquals(cnt, newComposite(newOffset(1, 1, 2, 3), newOffset(5, 8, 13, 21)));
- assertFalse(cnt.equals(newComposite(newOffset(5, 8, 13, 21))));
+ assertNotEquals(cnt, newComposite(newOffset(5, 8, 13, 21)));
}
private static CompositeContinuation newComposite(EncodableContinuation... children) {
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 4a7c6179db7..268a3ceb635 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
@@ -34,7 +34,7 @@ import com.yahoo.searchlib.expression.ConstantNode;
import com.yahoo.searchlib.expression.IntegerResultNode;
import com.yahoo.searchlib.expression.StringResultNode;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
@@ -45,12 +45,7 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
-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.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -58,14 +53,14 @@ import static org.junit.Assert.fail;
public class GroupingExecutorTestCase {
@Test
- public void requireThatNullRequestsPass() {
+ void requireThatNullRequestsPass() {
Result res = newExecution(new GroupingExecutor()).search(newQuery());
assertNotNull(res);
assertEquals(0, res.hits().size());
}
@Test
- public void requireThatEmptyRequestsPass() {
+ void requireThatEmptyRequestsPass() {
Query query = newQuery();
GroupingRequest.newInstance(query).setRootOperation(new AllOperation());
Result res = newExecution(new GroupingExecutor()).search(query);
@@ -74,7 +69,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatRequestsAreTransformed() {
+ void requireThatRequestsAreTransformed() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
@@ -90,7 +85,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatEachBelowAllDoesNotBlowUp() {
+ void requireThatEachBelowAllDoesNotBlowUp() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(each(output(summary(bar))))"));
@@ -100,7 +95,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatSearchIsMultiPass() {
+ void requireThatSearchIsMultiPass() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
@@ -110,7 +105,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatPassRequestsSingleLevel() {
+ void requireThatPassRequestsSingleLevel() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
@@ -126,7 +121,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatAggregationPerHitWithoutGroupingDoesNotWorkYet() {
+ void requireThatAggregationPerHitWithoutGroupingDoesNotWorkYet() {
try {
execute("each(output(strlen(customer)))");
fail();
@@ -136,19 +131,19 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatAggregationWithoutGroupingWorks() {
- List<Grouping> groupings=execute("all(output(count()))");
- assertEquals(1,groupings.size());
+ void requireThatAggregationWithoutGroupingWorks() {
+ List<Grouping> groupings = execute("all(output(count()))");
+ assertEquals(1, groupings.size());
assertEquals(0, groupings.get(0).getLevels().size());
assertEquals(ConstantNode.class, groupings.get(0).getRoot().getAggregationResults().get(0).getExpression().getClass());
}
@Test
- public void requireThatGroupingIsParallel() {
+ void requireThatGroupingIsParallel() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))) as(max)" +
- " each(output(min(bar))) as(min))"));
+ " each(output(min(bar))) as(min))"));
GroupingCounter cnt = new GroupingCounter();
newExecution(new GroupingExecutor(), cnt).search(query);
assertEquals(2, cnt.passList.size());
@@ -157,11 +152,11 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatParallelGroupingIsNotRedundant() {
+ void requireThatParallelGroupingIsNotRedundant() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))) as(shallow)" +
- " each(group(baz) each(output(max(cox)))) as(deep))"));
+ " each(group(baz) each(output(max(cox)))) as(deep))"));
GroupingCounter cnt = new GroupingCounter();
newExecution(new GroupingExecutor(), cnt).search(query);
assertEquals(3, cnt.passList.size());
@@ -171,7 +166,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatPassResultsAreMerged() {
+ void requireThatPassResultsAreMerged() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(min(bar), max(bar))))"));
@@ -187,14 +182,14 @@ 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 GroupingListHit(List.of(grpA), null),
- new GroupingListHit(List.of(grpB), null))));
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grpA), null),
+ new GroupingListHit(List.of(grpB), null))));
Group grp = req.getResultGroup(exec.search(query));
assertEquals(1, grp.size());
Hit hit = grp.get(0);
assertTrue(hit instanceof GroupList);
- GroupList lst = (GroupList)hit;
+ GroupList lst = (GroupList) hit;
assertEquals(3, lst.size());
assertNotNull(hit = lst.get("group:string:uniqueA"));
assertEquals(6L, hit.getField("max(bar)"));
@@ -206,7 +201,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatUnexpectedGroupingResultsAreIgnored() {
+ void requireThatUnexpectedGroupingResultsAreIgnored() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(max(bar))))"));
@@ -220,14 +215,14 @@ 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 GroupingListHit(List.of(grpExpected), null),
- new GroupingListHit(List.of(grpUnexpected), null))));
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grpExpected), null),
+ new GroupingListHit(List.of(grpUnexpected), null))));
Group grp = req.getResultGroup(exec.search(query));
assertEquals(1, grp.size());
Hit hit = grp.get(0);
assertTrue(hit instanceof GroupList);
- GroupList lst = (GroupList)hit;
+ GroupList lst = (GroupList) hit;
assertEquals(1, lst.size());
assertNotNull(hit = lst.get("group:string:expected"));
assertEquals(69L, hit.getField("max(bar)"));
@@ -235,7 +230,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatHitsAreFilled() {
+ void requireThatHitsAreFilled() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar)))))"));
@@ -243,20 +238,20 @@ public class GroupingExecutorTestCase {
Grouping grp0 = new Grouping(0);
grp0.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar"))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar"))
+ ));
Grouping grp1 = new Grouping(0);
grp1.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))
+ ));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(grp0), null),
- new GroupingListHit(List.of(grp1), null))),
- new FillRequestThrower());
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grp0), null),
+ new GroupingListHit(List.of(grp1), null))),
+ new FillRequestThrower());
Result res = exec.search(query);
-
+
// Fill with summary specified in grouping
try {
exec.fill(res);
@@ -275,59 +270,59 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatUnfilledHitsRenderError() {
+ void requireThatUnfilledHitsRenderError() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar)))))"));
Grouping grp0 = new Grouping(0);
grp0.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar"))));
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
+ .addAggregationResult(new HitsAggregationResult(1, "bar"))));
Grouping grp1 = new Grouping(0);
grp1.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(
- new HitsAggregationResult(1, "bar")
- .addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
+ .addAggregationResult(
+ new HitsAggregationResult(1, "bar")
+ .addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(grp0), null),
- new GroupingListHit(List.of(grp1), null))),
- new FillErrorProvider());
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grp0), null),
+ new GroupingListHit(List.of(grp1), null))),
+ new FillErrorProvider());
Result res = exec.search(query);
exec.fill(res);
assertNotNull(res.hits().getError());
}
@Test
- public void requireThatGroupRelevanceCanBeSynthesized() {
+ void requireThatGroupRelevanceCanBeSynthesized() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) order(count()) each(output(count())))"));
Grouping grp = new Grouping(0);
grp.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group()
- .setId(new StringResultNode("foo"))
- .addAggregationResult(new CountAggregationResult(1))
- .addOrderBy(new AggregationRefNode(0), true))
- .addChild(new com.yahoo.searchlib.aggregation.Group()
- .setId(new StringResultNode("bar"))
- .addAggregationResult(new CountAggregationResult(2))
- .addOrderBy(new AggregationRefNode(0), true)));
+ .addChild(new com.yahoo.searchlib.aggregation.Group()
+ .setId(new StringResultNode("foo"))
+ .addAggregationResult(new CountAggregationResult(1))
+ .addOrderBy(new AggregationRefNode(0), true))
+ .addChild(new com.yahoo.searchlib.aggregation.Group()
+ .setId(new StringResultNode("bar"))
+ .addAggregationResult(new CountAggregationResult(2))
+ .addOrderBy(new AggregationRefNode(0), true)));
Result res = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(grp), null),
- new GroupingListHit(List.of(grp), null)))).search(query);
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grp), null),
+ new GroupingListHit(List.of(grp), null)))).search(query);
- GroupList groupList = (GroupList)req.getResultGroup(res).get(0);
+ GroupList groupList = (GroupList) req.getResultGroup(res).get(0);
assertEquals(1.0, groupList.get(0).getRelevance().getScore(), 1E-6);
assertEquals(0.5, groupList.get(1).getRelevance().getScore(), 1E-6);
}
@Test
- public void requireThatErrorsAreHandled() {
+ void requireThatErrorsAreHandled() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar)))))"));
@@ -335,20 +330,20 @@ public class GroupingExecutorTestCase {
Grouping grp0 = new Grouping(0);
grp0.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar"))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar"))
+ ));
Grouping grp1 = new Grouping(0);
grp1.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))
+ ));
ErrorProvider err = new ErrorProvider(1);
Execution exec = newExecution(new GroupingExecutor(),
- err,
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(grp0), null),
- new GroupingListHit(List.of(grp1), null))));
+ err,
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grp0), null),
+ new GroupingListHit(List.of(grp1), null))));
Result res = exec.search(query);
assertNotNull(res.hits().getError());
assertEquals(Error.TIMEOUT.code, res.hits().getError().getCode());
@@ -356,10 +351,10 @@ public class GroupingExecutorTestCase {
err = new ErrorProvider(0);
exec = newExecution(new GroupingExecutor(),
- err,
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(grp0), null),
- new GroupingListHit(List.of(grp1), null))));
+ err,
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(grp0), null),
+ new GroupingListHit(List.of(grp1), null))));
res = exec.search(query);
assertNotNull(res.hits().getError());
assertEquals(Error.TIMEOUT.code, res.hits().getError().getCode());
@@ -367,39 +362,39 @@ public class GroupingExecutorTestCase {
}
@Test
- public void requireThatHitsAreFilledWithCorrectSummary() {
+ void requireThatHitsAreFilledWithCorrectSummary() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar))) as(bar) " +
- " each(output(summary(baz))) as(baz)))"));
+ " each(output(summary(baz))) as(baz)))"));
Grouping pass0A = new Grouping(0);
pass0A.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar"))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar"))
+ ));
Grouping pass0B = new Grouping(1);
pass0B.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "baz"))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "baz"))
+ ));
GlobalId gid1 = new GlobalId((new DocumentId("id:ns:type::1")).getGlobalId());
GlobalId gid2 = new GlobalId((new DocumentId("id:ns:type::2")).getGlobalId());
Grouping pass1A = new Grouping(0);
pass1A.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(1, gid1, 3)))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(1, gid1, 3)))
+ ));
Grouping pass1B = new Grouping(1);
pass1B.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "baz").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(4, gid2, 6)))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "baz").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(4, gid2, 6)))
+ ));
SummaryMapper sm = new SummaryMapper();
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(Arrays.asList(pass0A, pass0B), null),
- new GroupingListHit(Arrays.asList(pass1A, pass1B), null))),
- sm);
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(Arrays.asList(pass0A, pass0B), null),
+ new GroupingListHit(Arrays.asList(pass1A, pass1B), null))),
+ sm);
exec.fill(exec.search(query), "default");
assertEquals(2, sm.hitsBySummary.size());
@@ -408,51 +403,51 @@ public class GroupingExecutorTestCase {
assertEquals(1, lst.size());
Hit hit = lst.get(0);
assertTrue(hit instanceof FastHit);
- assertEquals(1, ((FastHit)hit).getPartId());
- assertEquals(gid1, ((FastHit)hit).getGlobalId());
+ assertEquals(1, ((FastHit) hit).getPartId());
+ assertEquals(gid1, ((FastHit) hit).getGlobalId());
assertNotNull(lst = sm.hitsBySummary.get("baz"));
assertNotNull(lst);
assertEquals(1, lst.size());
hit = lst.get(0);
assertTrue(hit instanceof FastHit);
- assertEquals(4, ((FastHit)hit).getPartId());
- assertEquals(gid2, ((FastHit)hit).getGlobalId());
+ assertEquals(4, ((FastHit) hit).getPartId());
+ assertEquals(gid2, ((FastHit) hit).getGlobalId());
}
@Test
- public void requireThatDefaultSummaryNameFillsHitsWithNull() {
+ void requireThatDefaultSummaryNameFillsHitsWithNull() {
Query query = newQuery();
GroupingRequest req = GroupingRequest.newInstance(query);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary()))) as(foo))"));
Grouping pass0 = new Grouping(0);
pass0.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group()
- .setId(new StringResultNode("foo"))
- .addAggregationResult(
- new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME))));
+ .addChild(new com.yahoo.searchlib.aggregation.Group()
+ .setId(new StringResultNode("foo"))
+ .addAggregationResult(
+ new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME))));
Grouping pass1 = new Grouping(0);
pass1.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group()
- .setId(new StringResultNode("foo"))
- .addAggregationResult(
- new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME)
- .addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
+ .addChild(new com.yahoo.searchlib.aggregation.Group()
+ .setId(new StringResultNode("foo"))
+ .addAggregationResult(
+ new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME)
+ .addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(
- new GroupingListHit(List.of(pass0), null),
- new GroupingListHit(List.of(pass1), null))));
+ new ResultProvider(Arrays.asList(
+ new GroupingListHit(List.of(pass0), null),
+ new GroupingListHit(List.of(pass1), null))));
Result res = exec.search(query);
exec.fill(res);
- Hit hit = ((HitList)((Group)((GroupList)req.getResultGroup(res).get(0)).get(0)).get(0)).get(0);
+ Hit hit = ((HitList) ((Group) ((GroupList) req.getResultGroup(res).get(0)).get(0)).get(0)).get(0);
assertTrue(hit instanceof FastHit);
assertTrue(hit.isFilled(null));
}
@Test
- public void requireThatHitsAreAttachedToCorrectQuery() {
+ void requireThatHitsAreAttachedToCorrectQuery() {
Query queryA = newQuery();
GroupingRequest req = GroupingRequest.newInstance(queryA);
req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar)))))"));
@@ -460,24 +455,24 @@ public class GroupingExecutorTestCase {
Grouping grp = new Grouping(0);
grp.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar"))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar"))
+ ));
GroupingListHit pass0 = new GroupingListHit(List.of(grp), null);
GlobalId gid = new GlobalId((new DocumentId("id:ns:type::1")).getGlobalId());
grp = new Grouping(0);
grp.setRoot(new com.yahoo.searchlib.aggregation.Group()
.addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo"))
- .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(4, gid, 6)))
- ));
+ .addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit(4, gid, 6)))
+ ));
GroupingListHit pass1 = new GroupingListHit(List.of(grp), null);
Query queryB = newQuery(); // required by GroupingListHit.getSearchQuery()
pass1.setQuery(queryB);
QueryMapper qm = new QueryMapper();
Execution exec = newExecution(new GroupingExecutor(),
- new ResultProvider(Arrays.asList(pass0, pass1)),
- qm);
+ new ResultProvider(Arrays.asList(pass0, pass1)),
+ qm);
exec.fill(exec.search(queryA));
assertEquals(1, qm.hitsByQuery.size());
assertTrue(qm.hitsByQuery.containsKey(queryB));
@@ -488,7 +483,7 @@ public class GroupingExecutorTestCase {
* (triggered by the exc.search call in the below).
*/
@Test
- public void testRankProperties() {
+ void testRankProperties() {
final double delta = 0.000000001;
Execution exc = newExecution(new GroupingExecutor());
{
@@ -532,7 +527,7 @@ public class GroupingExecutorTestCase {
}
@Test
- public void testIllegalQuery() {
+ void testIllegalQuery() {
Execution exc = newExecution(new GroupingExecutor());
Query query = new Query();
@@ -541,14 +536,14 @@ public class GroupingExecutorTestCase {
Result result = exc.search(query);
com.yahoo.search.result.ErrorMessage message = result.hits().getError();
- assertNotNull("Got error", message);
+ assertNotNull(message, "Got error");
assertEquals("Illegal query", message.getMessage());
assertEquals("No query", message.getDetailedMessage());
assertEquals(3, message.getCode());
}
@Test
- public void testResultsFromMultipleDocumentTypes() {
+ void testResultsFromMultipleDocumentTypes() {
Query query = newQuery();
GroupingRequest request = GroupingRequest.newInstance(query);
request.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(min(bar), max(bar))))"));
@@ -556,38 +551,38 @@ public class GroupingExecutorTestCase {
Map<String, List<GroupingListHit>> resultsByDocumentType = new HashMap<>();
Grouping groupA1 = new Grouping(0);
groupA1.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueA")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(6)).setTag(4)))
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueA")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(6)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4)))
);
Grouping groupA2 = new Grouping(0);
groupA2.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueB")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4)))
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MinAggregationResult().setMin(new IntegerResultNode(6)).setTag(3)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueB")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(9)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MinAggregationResult().setMin(new IntegerResultNode(6)).setTag(3)))
);
Grouping groupB1 = new Grouping(0);
groupB1.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueA")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(2)).setTag(4)))
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(3)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueA")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(2)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(3)).setTag(4)))
);
Grouping groupB2 = new Grouping(0);
groupB2.setRoot(new com.yahoo.searchlib.aggregation.Group()
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueC")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(7)).setTag(4)))
- .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(11)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("uniqueC")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(7)).setTag(4)))
+ .addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("common")).addAggregationResult(new MaxAggregationResult().setMax(new IntegerResultNode(11)).setTag(4)))
);
resultsByDocumentType.put("typeA", List.of(new GroupingListHit(List.of(groupA1), null),
- new GroupingListHit(List.of(groupA2), null)));
+ new GroupingListHit(List.of(groupA2), null)));
resultsByDocumentType.put("typeB", List.of(new GroupingListHit(List.of(groupB1), null),
- new GroupingListHit(List.of(groupB2), null)));
+ new GroupingListHit(List.of(groupB2), null)));
Execution execution = newExecution(new GroupingExecutor(),
- new MockClusterSearcher(),
- new MultiDocumentTypeResultProvider(resultsByDocumentType));
+ new MockClusterSearcher(),
+ new MultiDocumentTypeResultProvider(resultsByDocumentType));
Result result = execution.search(query);
Group group = request.getResultGroup(result);
assertEquals(1, group.size());
Hit hit = group.get(0);
assertTrue(hit instanceof GroupList);
- GroupList list = (GroupList)hit;
+ GroupList list = (GroupList) hit;
assertEquals(4, list.size());
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingTransformTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingTransformTestCase.java
index c6503617da5..c41fb03f2f5 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingTransformTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/GroupingTransformTestCase.java
@@ -2,9 +2,9 @@
package com.yahoo.search.grouping.vespa;
import com.yahoo.search.grouping.Continuation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -14,14 +14,14 @@ public class GroupingTransformTestCase {
private static final int REQUEST_ID = 0;
@Test
- public void requireThatLabelCanBeSet() {
+ void requireThatLabelCanBeSet() {
GroupingTransform transform = newTransform();
transform.putLabel(0, 1, "foo", "my_type");
assertEquals("foo", transform.getLabel(1));
}
@Test
- public void requireThatLabelCanNotBeReplaced() {
+ void requireThatLabelCanNotBeReplaced() {
GroupingTransform transform = newTransform();
transform.putLabel(0, 1, "foo", "my_type");
try {
@@ -29,12 +29,12 @@ public class GroupingTransformTestCase {
fail();
} catch (IllegalStateException e) {
assertEquals("Can not set label of my_type 1 to 'bar' because it is already set to 'foo'.",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void requireThatLabelIsUniqueAmongSiblings() {
+ void requireThatLabelIsUniqueAmongSiblings() {
GroupingTransform transform = newTransform();
transform.putLabel(0, 1, "foo", "my_type");
try {
@@ -42,26 +42,26 @@ public class GroupingTransformTestCase {
fail();
} catch (UnsupportedOperationException e) {
assertEquals("Can not use my_type label 'foo' for multiple siblings.",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void requireThatMaxDefaultsToZero() {
+ void requireThatMaxDefaultsToZero() {
GroupingTransform transform = newTransform();
assertEquals(0, transform.getMax(6));
assertEquals(0, transform.getMax(9));
}
@Test
- public void requireThatMaxCanBeSet() {
+ void requireThatMaxCanBeSet() {
GroupingTransform transform = newTransform();
transform.putMax(0, 69, "my_type");
assertEquals(69, transform.getMax(0));
}
@Test
- public void requireThatMaxCanNotBeReplaced() {
+ void requireThatMaxCanNotBeReplaced() {
GroupingTransform transform = newTransform();
transform.putMax(0, 6, "my_type");
try {
@@ -69,27 +69,27 @@ public class GroupingTransformTestCase {
fail();
} catch (IllegalStateException e) {
assertEquals("Can not set max of my_type 0 to 9 because it is already set to 6.",
- e.getMessage());
+ e.getMessage());
}
assertEquals(6, transform.getMax(0));
}
@Test
- public void requireThatOffsetDefaultsToZero() {
+ void requireThatOffsetDefaultsToZero() {
GroupingTransform transform = newTransform();
assertEquals(0, transform.getOffset(6));
assertEquals(0, transform.getOffset(9));
}
@Test
- public void requireThatOffsetContinuationsCanBeAdded() {
+ void requireThatOffsetContinuationsCanBeAdded() {
GroupingTransform transform = newTransform();
transform.addContinuation(newStableOffset(newResultId(), 6, 9));
assertEquals(9, transform.getOffset(6));
}
@Test
- public void requireThatOffsetByIdCanBeReplaced() {
+ void requireThatOffsetByIdCanBeReplaced() {
GroupingTransform transform = newTransform();
ResultId id = newResultId(6, 9);
transform.addContinuation(newStableOffset(id, 0, 6));
@@ -103,7 +103,7 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatOffsetByTagEqualsHighestSibling() {
+ void requireThatOffsetByTagEqualsHighestSibling() {
GroupingTransform transform = newTransform();
transform.addContinuation(newStableOffset(newResultId(1), 69, 6));
assertEquals(6, transform.getOffset(69));
@@ -116,7 +116,7 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatOffsetContinuationsCanBeReplaced() {
+ void requireThatOffsetContinuationsCanBeReplaced() {
GroupingTransform transform = newTransform();
ResultId id = newResultId(6, 9);
transform.addContinuation(newStableOffset(id, 1, 1));
@@ -136,7 +136,7 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatUnstableOffsetsAreTracked() {
+ void requireThatUnstableOffsetsAreTracked() {
GroupingTransform transform = newTransform();
ResultId stableId = newResultId(6);
transform.addContinuation(newStableOffset(stableId, 1, 1));
@@ -148,17 +148,17 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatCompositeContinuationsAreDecomposed() {
+ void requireThatCompositeContinuationsAreDecomposed() {
GroupingTransform transform = newTransform();
transform.addContinuation(new CompositeContinuation()
- .add(newStableOffset(newResultId(), 6, 9))
- .add(newStableOffset(newResultId(), 9, 6)));
+ .add(newStableOffset(newResultId(), 6, 9))
+ .add(newStableOffset(newResultId(), 9, 6)));
assertEquals(9, transform.getOffset(6));
assertEquals(6, transform.getOffset(9));
}
@Test
- public void requireThatUnsupportedContinuationsCanNotBeAdded() {
+ void requireThatUnsupportedContinuationsCanNotBeAdded() {
GroupingTransform transform = newTransform();
try {
transform.addContinuation(new Continuation() {
@@ -174,7 +174,7 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatUnrelatedContinuationsAreIgnored() {
+ void requireThatUnrelatedContinuationsAreIgnored() {
GroupingTransform transform = new GroupingTransform(REQUEST_ID);
ResultId id = ResultId.valueOf(REQUEST_ID + 1, 1);
transform.addContinuation(new OffsetContinuation(id, 2, 3, OffsetContinuation.FLAG_UNSTABLE));
@@ -184,7 +184,7 @@ public class GroupingTransformTestCase {
}
@Test
- public void requireThatToStringIsVerbose() {
+ void requireThatToStringIsVerbose() {
GroupingTransform transform = new GroupingTransform(REQUEST_ID);
transform.putLabel(1, 1, "label1", "type1");
transform.putLabel(2, 2, "label2", "type2");
@@ -193,19 +193,19 @@ public class GroupingTransformTestCase {
transform.putMax(5, 5, "type5");
transform.putMax(6, 6, "type6");
assertEquals("groupingTransform {\n" +
- "\tlabels {\n" +
- "\t\t1 : label1\n" +
- "\t\t2 : label2\n" +
- "\t}\n" +
- "\toffsets {\n" +
- "\t\t3 : 3\n" +
- "\t\t4 : 4\n" +
- "\t}\n" +
- "\tmaxes {\n" +
- "\t\t5 : 5\n" +
- "\t\t6 : 6\n" +
- "\t}\n" +
- "}", transform.toString());
+ "\tlabels {\n" +
+ "\t\t1 : label1\n" +
+ "\t\t2 : label2\n" +
+ "\t}\n" +
+ "\toffsets {\n" +
+ "\t\t3 : 3\n" +
+ "\t\t4 : 4\n" +
+ "\t}\n" +
+ "\tmaxes {\n" +
+ "\t\t5 : 5\n" +
+ "\t\t6 : 6\n" +
+ "\t}\n" +
+ "}", transform.toString());
}
private static GroupingTransform newTransform() {
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
index b3afd8c5f50..5263583f771 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/HitConverterTestCase.java
@@ -17,11 +17,11 @@ import com.yahoo.search.schema.Schema;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.FS4Hit;
import com.yahoo.searchlib.aggregation.VdsHit;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -33,7 +33,7 @@ public class HitConverterTestCase {
}
@Test
- public void requireThatHitsAreConverted() {
+ void requireThatHitsAreConverted() {
HitConverter converter = new HitConverter(new MySearcher(), new Query());
Hit hit = converter.toSearchHit("default", new FS4Hit(1, createGlobalId(2), 3).setContext(context()));
assertNotNull(hit);
@@ -45,7 +45,7 @@ public class HitConverterTestCase {
}
@Test
- public void requireThatContextDataIsCopied() {
+ void requireThatContextDataIsCopied() {
Hit ctxHit = context();
ctxHit.setSource("69");
Query ctxQuery = new Query();
@@ -55,14 +55,14 @@ public class HitConverterTestCase {
Hit hit = converter.toSearchHit("default", new FS4Hit(1, createGlobalId(2), 3).setContext(ctxHit));
assertNotNull(hit);
assertTrue(hit instanceof FastHit);
- assertEquals(1, ((FastHit)hit).getPartId());
- assertEquals(createGlobalId(2), ((FastHit)hit).getGlobalId());
+ assertEquals(1, ((FastHit) hit).getPartId());
+ assertEquals(createGlobalId(2), ((FastHit) hit).getGlobalId());
assertSame(ctxQuery, hit.getQuery());
assertEquals(ctxHit.getSource(), hit.getSource());
}
@Test
- public void requireThatSummaryClassIsSet() {
+ void requireThatSummaryClassIsSet() {
Searcher searcher = new MySearcher();
HitConverter converter = new HitConverter(searcher, new Query());
Hit hit = converter.toSearchHit("69", new FS4Hit(1, createGlobalId(2), 3).setContext(context()));
@@ -72,7 +72,7 @@ public class HitConverterTestCase {
}
@Test
- public void requireThatHitHasContext() {
+ void requireThatHitHasContext() {
HitConverter converter = new HitConverter(new MySearcher(), new Query());
try {
converter.toSearchHit("69", new FS4Hit(1, createGlobalId(2), 3));
@@ -83,7 +83,7 @@ public class HitConverterTestCase {
}
@Test
- public void requireThatUnsupportedHitClassThrows() {
+ void requireThatUnsupportedHitClassThrows() {
HitConverter converter = new HitConverter(new MySearcher(), new Query());
try {
converter.toSearchHit("69", new com.yahoo.searchlib.aggregation.Hit() {
@@ -107,10 +107,10 @@ public class HitConverterTestCase {
}
@Test
- public void requireThatVdsHitCanBeConverted() {
+ void requireThatVdsHitCanBeConverted() {
HitConverter converter = new HitConverter(new MySearcher(), new Query());
GroupingListHit context = new GroupingListHit(null, sixtynine());
- VdsHit lowHit = new VdsHit("id:ns:type::", new byte[] { 0x55, 0x55, 0x55, 0x55 }, 1);
+ VdsHit lowHit = new VdsHit("id:ns:type::", new byte[]{0x55, 0x55, 0x55, 0x55}, 1);
lowHit.setContext(context);
Hit hit = converter.toSearchHit("69", lowHit);
assertNotNull(hit);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerDecoderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerDecoderTestCase.java
index 7d0827f0eb7..c574a99d2c0 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerDecoderTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerDecoderTestCase.java
@@ -1,10 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.vespa;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -12,7 +11,7 @@ import static org.junit.Assert.fail;
public class IntegerDecoderTestCase {
@Test
- public void requireThatIntDecoderWorksAsExpected() {
+ void requireThatIntDecoderWorksAsExpected() {
assertDecode("A", 0);
assertDecode("BC", 1);
assertDecode("CBI", 12);
@@ -29,7 +28,7 @@ public class IntegerDecoderTestCase {
}
@Test
- public void requireThatDecoderThrowsExceptionOnBadInput() {
+ void requireThatDecoderThrowsExceptionOnBadInput() {
try {
new IntegerDecoder("B").next();
fail();
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java
index e7a4f1572c5..c644607b3ae 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/IntegerEmbedderTestCase.java
@@ -1,9 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.vespa;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Simon Thoresen Hult
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
public class IntegerEmbedderTestCase {
@Test
- public void requireThatIntEncoderWorksAsExpected() {
+ void requireThatIntEncoderWorksAsExpected() {
assertEncode("A", 0);
assertEncode("BC", 1);
assertEncode("CBI", 12);
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/OffsetContinuationTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/OffsetContinuationTestCase.java
index 7242e5ba054..513f8c89f05 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/OffsetContinuationTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/OffsetContinuationTestCase.java
@@ -2,9 +2,9 @@
package com.yahoo.search.grouping.vespa;
import com.yahoo.search.grouping.Continuation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -12,7 +12,7 @@ import static org.junit.Assert.*;
public class OffsetContinuationTestCase {
@Test
- public void requireThatNullResultIdThrowsException() {
+ void requireThatNullResultIdThrowsException() {
try {
new OffsetContinuation(null, 0, 0, 0);
fail();
@@ -22,7 +22,7 @@ public class OffsetContinuationTestCase {
}
@Test
- public void requireThatAccessorsWork() {
+ void requireThatAccessorsWork() {
OffsetContinuation cnt = new OffsetContinuation(ResultId.valueOf(1), 2, 3, 4);
assertEquals(ResultId.valueOf(1), cnt.getResultId());
assertEquals(2, cnt.getTag());
@@ -44,7 +44,7 @@ public class OffsetContinuationTestCase {
}
@Test
- public void requireThatOffsetContinuationsCanBeEncoded() {
+ void requireThatOffsetContinuationsCanBeEncoded() {
assertEncode("BCBCBCBEBG", newOffset(1, 1, 2, 3));
assertEncode("BCBKCBACBKCCK", newOffset(5, 8, 13, 21));
assertEncode("BCBBBBBDBF", newOffset(-1, -1, -2, -3));
@@ -52,7 +52,7 @@ public class OffsetContinuationTestCase {
}
@Test
- public void requireThatOffsetContinuationsCanBeDecoded() {
+ void requireThatOffsetContinuationsCanBeDecoded() {
assertDecode("BCBCBCBEBG", newOffset(1, 1, 2, 3));
assertDecode("BCBKCBACBKCCK", newOffset(5, 8, 13, 21));
assertDecode("BCBBBBBDBF", newOffset(-1, -1, -2, -3));
@@ -60,18 +60,18 @@ public class OffsetContinuationTestCase {
}
@Test
- public void requireThatHashCodeIsImplemented() {
+ void requireThatHashCodeIsImplemented() {
assertEquals(newOffset(1, 1, 2, 3).hashCode(), newOffset(1, 1, 2, 3).hashCode());
}
@Test
- public void requireThatEqualsIsImplemented() {
+ void requireThatEqualsIsImplemented() {
Continuation cnt = newOffset(1, 1, 2, 3);
- assertFalse(cnt.equals(new Object()));
- assertFalse(cnt.equals(newOffset(0, 1, 2, 3)));
- assertFalse(cnt.equals(newOffset(1, 0, 2, 3)));
- assertFalse(cnt.equals(newOffset(1, 1, 0, 3)));
- assertFalse(cnt.equals(newOffset(1, 1, 2, 0)));
+ assertNotEquals(cnt, new Object());
+ assertNotEquals(cnt, newOffset(0, 1, 2, 3));
+ assertNotEquals(cnt, newOffset(1, 0, 2, 3));
+ assertNotEquals(cnt, newOffset(1, 1, 0, 3));
+ assertNotEquals(cnt, newOffset(1, 1, 2, 0));
assertEquals(cnt, newOffset(1, 1, 2, 3));
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java
index 5882c56c688..f8e67a10076 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java
@@ -26,7 +26,7 @@ import com.yahoo.searchlib.expression.StringResultNode;
import com.yahoo.searchlib.expression.TimeStampFunctionNode;
import com.yahoo.searchlib.expression.ToStringFunctionNode;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
@@ -34,9 +34,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -44,19 +42,19 @@ import static org.junit.Assert.fail;
public class RequestBuilderTestCase {
@Test
- public void requireThatAllAggregationResulsAreSupported() {
- assertLayout("all(group(a) each(output(avg(b))))", "[[{ Attribute, result = [Average] }]]");
- assertLayout("all(group(a) each(output(count())))", "[[{ Attribute, result = [Count] }]]");
- assertLayout("all(group(a) each(output(max(b))))", "[[{ Attribute, result = [Max] }]]");
- assertLayout("all(group(a) each(output(min(b))))", "[[{ Attribute, result = [Min] }]]");
- assertLayout("all(group(a) each(output(sum(b))))", "[[{ Attribute, result = [Sum] }]]");
- assertLayout("all(group(a) each(each(output(summary()))))", "[[{ Attribute, result = [Hits] }]]");
- assertLayout("all(group(a) each(output(xor(b))))", "[[{ Attribute, result = [Xor] }]]");
- assertLayout("all(group(a) each(output(stddev(b))))", "[[{ Attribute, result = [StandardDeviation] }]]");
+ void requireThatAllAggregationResulsAreSupported() {
+ assertLayout("all(group(a) each(output(avg(b))))", "[[{ Attribute, result = [Average] }]]");
+ assertLayout("all(group(a) each(output(count())))", "[[{ Attribute, result = [Count] }]]");
+ assertLayout("all(group(a) each(output(max(b))))", "[[{ Attribute, result = [Max] }]]");
+ assertLayout("all(group(a) each(output(min(b))))", "[[{ Attribute, result = [Min] }]]");
+ assertLayout("all(group(a) each(output(sum(b))))", "[[{ Attribute, result = [Sum] }]]");
+ assertLayout("all(group(a) each(each(output(summary()))))", "[[{ Attribute, result = [Hits] }]]");
+ assertLayout("all(group(a) each(output(xor(b))))", "[[{ Attribute, result = [Xor] }]]");
+ assertLayout("all(group(a) each(output(stddev(b))))", "[[{ Attribute, result = [StandardDeviation] }]]");
}
@Test
- public void requireThatExpressionCountAggregationResultIsSupported() {
+ void requireThatExpressionCountAggregationResultIsSupported() {
RequestBuilder builder = new RequestBuilder(0);
builder.setRootOperation(GroupingOperation.fromString("all(group(foo) output(count()))"));
builder.build();
@@ -73,28 +71,28 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatTopNIsHonoured() {
+ void requireThatTopNIsHonoured() {
List<Grouping> gl = getRequestList("all(max(3) all(group(product_id) max(5) each(output(sum(price)))))");
assertEquals(1, gl.size());
assertEquals(3, gl.get(0).getTopN());
}
@Test
- public void requireThatTopNIsHonouredWhenNested() {
+ void requireThatTopNIsHonouredWhenNested() {
List<Grouping> gl = getRequestList("all( all(max(3) all(group(product_id) max(5) each(output(sum(price))))))");
assertEquals(1, gl.size());
assertEquals(3, gl.get(0).getTopN());
}
@Test
- public void requireThatTopNIsInherited() {
+ void requireThatTopNIsInherited() {
List<Grouping> gl = getRequestList("all(max(7) all( all(group(product_id) max(5) each(output(sum(price))))))");
assertEquals(1, gl.size());
assertEquals(7, gl.get(0).getTopN());
}
@Test
- public void requireThatTopNIsMinimum() {
+ void requireThatTopNIsMinimum() {
List<Grouping> gl = getRequestList("all(max(7) all(max(3) all(group(product_id) max(5) each(output(sum(price))))))");
assertEquals(1, gl.size());
assertEquals(3, gl.get(0).getTopN());
@@ -104,7 +102,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatTopNIsIndividual() {
+ void requireThatTopNIsIndividual() {
List<Grouping> gl = getRequestList("all( all(max(3) all(group(product_id) max(5) each(output(sum(price))))) all(group(filter_cluster3) order(count()) each(output(count()))))");
assertEquals(2, gl.size());
assertEquals(3, gl.get(0).getTopN());
@@ -117,7 +115,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatAllExpressionNodesAreSupported() {
+ void requireThatAllExpressionNodesAreSupported() {
assertLayout("all(group(add(a,b)) each(output(count())))", "[[{ Add, result = [Count] }]]");
assertLayout("all(group(and(a,b)) each(output(count())))", "[[{ And, result = [Count] }]]");
assertLayout("all(group(a) each(output(count())))", "[[{ Attribute, result = [Count] }]]");
@@ -188,22 +186,22 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatForceSinglePassIsSupported() {
+ void requireThatForceSinglePassIsSupported() {
assertForceSinglePass("all(group(foo) each(output(count())))", "[false]");
assertForceSinglePass("all(group(foo) hint(singlepass) each(output(count())))", "[true]");
assertForceSinglePass("all(hint(singlepass) " +
- " all(group(foo) each(output(count())))" +
- " all(group(bar) each(output(count()))))",
- "[true, true]");
+ " all(group(foo) each(output(count())))" +
+ " all(group(bar) each(output(count()))))",
+ "[true, true]");
// it would be really nice if this test returned [true, true], but that is not how the AST is built
assertForceSinglePass("all(all(group(foo) hint(singlepass) each(output(count())))" +
- " all(group(bar) hint(singlepass) each(output(count()))))",
- "[false, false]");
+ " all(group(bar) hint(singlepass) each(output(count()))))",
+ "[false, false]");
}
@Test
- public void requireThatThereCanBeOnlyOneBuildCall() {
+ void requireThatThereCanBeOnlyOneBuildCall() {
RequestBuilder builder = new RequestBuilder(0);
builder.setRootOperation(GroupingOperation.fromString("all(group(foo) each(output(count())))"));
builder.build();
@@ -216,148 +214,148 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatNullSummaryClassProvidesDefault() {
+ void requireThatNullSummaryClassProvidesDefault() {
RequestBuilder reqBuilder = new RequestBuilder(0);
reqBuilder.setRootOperation(new AllOperation()
- .setGroupBy(new AttributeValue("foo"))
- .addChild(new EachOperation()
- .addChild(new EachOperation()
- .addOutput(new SummaryValue()))));
+ .setGroupBy(new AttributeValue("foo"))
+ .addChild(new EachOperation()
+ .addChild(new EachOperation()
+ .addOutput(new SummaryValue()))));
reqBuilder.setDefaultSummaryName(null);
reqBuilder.build();
- HitsAggregationResult hits = (HitsAggregationResult)reqBuilder.getRequestList().get(0)
- .getLevels().get(0)
- .getGroupPrototype()
- .getAggregationResults().get(0);
+ HitsAggregationResult hits = (HitsAggregationResult) reqBuilder.getRequestList().get(0)
+ .getLevels().get(0)
+ .getGroupPrototype()
+ .getAggregationResults().get(0);
assertEquals(ExpressionConverter.DEFAULT_SUMMARY_NAME, hits.getSummaryClass());
}
@Test
- public void requireThatGroupOfGroupsAreNotSupported() {
+ void requireThatGroupOfGroupsAreNotSupported() {
// "Can not group list of groups."
assertBuildFail("all(group(a) all(group(avg(b)) each(each(each(output(summary()))))))",
"Can not operate on list of list of groups.");
}
@Test
- public void requireThatAnonymousListsAreNotSupported() {
+ void requireThatAnonymousListsAreNotSupported() {
assertBuildFail("all(group(a) all(each(each(output(summary())))))",
- "Can not create anonymous list of groups.");
+ "Can not create anonymous list of groups.");
}
@Test
- public void requireThatOffsetContinuationCanModifyGroupingLevel() {
+ void requireThatOffsetContinuationCanModifyGroupingLevel() {
assertOffset("all(group(a) max(5) each(output(count())))",
- newOffset(2, 5),
- "[[{ tag = 2, max = [5, 11], hits = [] }]]");
+ newOffset(2, 5),
+ "[[{ tag = 2, max = [5, 11], hits = [] }]]");
assertOffset("all(group(a) max(5) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))",
- newOffset(2, 5),
- "[[{ tag = 2, max = [5, 11], hits = [] }]," +
- " [{ tag = 4, max = [5, 6], hits = [] }]]");
+ " each(output(count())) as(bar))",
+ newOffset(2, 5),
+ "[[{ tag = 2, max = [5, 11], hits = [] }]," +
+ " [{ tag = 4, max = [5, 6], hits = [] }]]");
assertOffset("all(group(a) max(5) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))",
+ " each(output(count())) as(bar))",
newComposite(newOffset(2, 5), newOffset(4, 10)),
"[[{ tag = 2, max = [5, 11], hits = [] }]," +
" [{ tag = 4, max = [5, 16], hits = [] }]]");
}
@Test
- public void requireThatOffsetContinuationCanModifyHitAggregator() {
+ void requireThatOffsetContinuationCanModifyHitAggregator() {
assertOffset("all(group(a) each(max(5) each(output(summary()))))",
- newOffset(3, 5),
- "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]]");
+ newOffset(3, 5),
+ "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]]");
assertOffset("all(group(a) each(max(5) each(output(summary()))) as(foo)" +
- " each(max(5) each(output(summary()))) as(bar))",
- newOffset(3, 5),
- "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 4, max = [0, -1], hits = [{ tag = 5, max = [5, 6] }] }]]");
+ " each(max(5) each(output(summary()))) as(bar))",
+ newOffset(3, 5),
+ "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 4, max = [0, -1], hits = [{ tag = 5, max = [5, 6] }] }]]");
assertOffset("all(group(a) each(max(5) each(output(summary()))) as(foo)" +
- " each(max(5) each(output(summary()))) as(bar))",
- newComposite(newOffset(3, 5), newOffset(5, 10)),
- "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 4, max = [0, -1], hits = [{ tag = 5, max = [5, 16] }] }]]");
+ " each(max(5) each(output(summary()))) as(bar))",
+ newComposite(newOffset(3, 5), newOffset(5, 10)),
+ "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 4, max = [0, -1], hits = [{ tag = 5, max = [5, 16] }] }]]");
}
@Test
- public void requireThatOffsetContinuationIsNotAppliedToGroupingLevelWithoutMax() {
+ void requireThatOffsetContinuationIsNotAppliedToGroupingLevelWithoutMax() {
assertOffset("all(group(a) each(output(count())))",
- newOffset(2, 5),
- "[[{ tag = 2, max = [0, -1], hits = [] }]]");
+ newOffset(2, 5),
+ "[[{ tag = 2, max = [0, -1], hits = [] }]]");
}
@Test
- public void requireThatOffsetContinuationIsNotAppliedToHitAggregatorWithoutMax() {
+ void requireThatOffsetContinuationIsNotAppliedToHitAggregatorWithoutMax() {
assertOffset("all(group(a) each(each(output(summary()))))",
- newOffset(3, 5),
- "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [0, -1] }] }]]");
+ newOffset(3, 5),
+ "[[{ tag = 2, max = [0, -1], hits = [{ tag = 3, max = [0, -1] }] }]]");
}
@Test
- public void requireThatUnstableContinuationsDoNotAffectRequestedGroupLists() {
+ void requireThatUnstableContinuationsDoNotAffectRequestedGroupLists() {
String request = "all(group(a) max(5) each(group(b) max(5) each(output(count())) as(a1_b1)" +
- " each(output(count())) as(a1_b2)) as(a1)" +
- " each(group(b) max(5) each(output(count())) as(a2_b1)" +
- " each(output(count())) as(a2_b2)) as(a2))";
+ " each(output(count())) as(a1_b2)) as(a1)" +
+ " each(group(b) max(5) each(output(count())) as(a2_b1)" +
+ " each(output(count())) as(a2_b2)) as(a2))";
CompositeContinuation session = newComposite(newOffset(2, 5), newOffset(3, 5), newOffset(5, 5),
- newOffset(7, 5), newOffset(8, 5), newOffset(10, 5));
+ newOffset(7, 5), newOffset(8, 5), newOffset(10, 5));
assertOffset(request, newComposite(session),
- "[[{ tag = 2, max = [5, 11], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
- " [{ tag = 2, max = [5, 11], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
+ "[[{ tag = 2, max = [5, 11], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
+ " [{ tag = 2, max = [5, 11], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(2, 10)),
- "[[{ tag = 2, max = [5, 16], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
- " [{ tag = 2, max = [5, 16], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
+ "[[{ tag = 2, max = [5, 16], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
+ " [{ tag = 2, max = [5, 16], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 11], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(7, 10)),
- "[[{ tag = 2, max = [5, 11], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
- " [{ tag = 2, max = [5, 11], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
+ "[[{ tag = 2, max = [5, 11], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
+ " [{ tag = 2, max = [5, 11], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(2, 10), newUnstableOffset(7, 10)),
- "[[{ tag = 2, max = [5, 16], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
- " [{ tag = 2, max = [5, 16], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
- " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
+ "[[{ tag = 2, max = [5, 16], hits = [] }, { tag = 3, max = [5, 11], hits = [] }]," +
+ " [{ tag = 2, max = [5, 16], hits = [] }, { tag = 5, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 10, max = [5, 11], hits = [] }]," +
+ " [{ tag = 7, max = [5, 16], hits = [] }, { tag = 8, max = [5, 11], hits = [] }]]");
}
@Test
- public void requireThatUnstableContinuationsDoNotAffectRequestedHitLists() {
+ void requireThatUnstableContinuationsDoNotAffectRequestedHitLists() {
String request = "all(group(a) max(5) each(max(5) each(output(summary())) as(a1_h1)" +
- " each(output(summary())) as(a1_h2)) as(a1)" +
- " each(max(5) each(output(summary())) as(a2_h1)" +
- " each(output(summary())) as(a2_h2)) as(a2))";
+ " each(output(summary())) as(a1_h2)) as(a1)" +
+ " each(max(5) each(output(summary())) as(a2_h1)" +
+ " each(output(summary())) as(a2_h2)) as(a2))";
CompositeContinuation session = newComposite(newOffset(2, 5), newOffset(3, 5), newOffset(4, 5),
- newOffset(5, 5), newOffset(6, 5), newOffset(7, 5));
+ newOffset(5, 5), newOffset(6, 5), newOffset(7, 5));
assertOffset(request, newComposite(session),
- "[[{ tag = 2, max = [5, 11], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 2, max = [5, 11], hits = [{ tag = 4, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 11], hits = [{ tag = 6, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 11], hits = [{ tag = 7, max = [5, 11] }] }]]");
+ "[[{ tag = 2, max = [5, 11], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 2, max = [5, 11], hits = [{ tag = 4, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 11], hits = [{ tag = 6, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 11], hits = [{ tag = 7, max = [5, 11] }] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(2, 10)),
- "[[{ tag = 2, max = [5, 16], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 2, max = [5, 16], hits = [{ tag = 4, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 11], hits = [{ tag = 6, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 11], hits = [{ tag = 7, max = [5, 11] }] }]]");
+ "[[{ tag = 2, max = [5, 16], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 2, max = [5, 16], hits = [{ tag = 4, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 11], hits = [{ tag = 6, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 11], hits = [{ tag = 7, max = [5, 11] }] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(5, 10)),
- "[[{ tag = 2, max = [5, 11], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 2, max = [5, 11], hits = [{ tag = 4, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 16], hits = [{ tag = 6, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 16], hits = [{ tag = 7, max = [5, 11] }] }]]");
+ "[[{ tag = 2, max = [5, 11], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 2, max = [5, 11], hits = [{ tag = 4, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 16], hits = [{ tag = 6, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 16], hits = [{ tag = 7, max = [5, 11] }] }]]");
assertOffset(request, newComposite(session, newUnstableOffset(2, 10), newUnstableOffset(5, 10)),
- "[[{ tag = 2, max = [5, 16], hits = [{ tag = 3, max = [5, 11] }] }]," +
- " [{ tag = 2, max = [5, 16], hits = [{ tag = 4, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 16], hits = [{ tag = 6, max = [5, 11] }] }]," +
- " [{ tag = 5, max = [5, 16], hits = [{ tag = 7, max = [5, 11] }] }]]");
+ "[[{ tag = 2, max = [5, 16], hits = [{ tag = 3, max = [5, 11] }] }]," +
+ " [{ tag = 2, max = [5, 16], hits = [{ tag = 4, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 16], hits = [{ tag = 6, max = [5, 11] }] }]," +
+ " [{ tag = 5, max = [5, 16], hits = [{ tag = 7, max = [5, 11] }] }]]");
}
@Test
- public void requireThatExpressionsCanBeAliased() {
+ void requireThatExpressionsCanBeAliased() {
OutputWriter writer = (groupingList, transform) -> groupingList.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0)
- .toString();
+ .toString();
RequestTest test = new RequestTest();
test.expectedOutput = new SumAggregationResult().setTag(3).setExpression(new AttributeNode("price")).toString();
@@ -373,89 +371,89 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatGroupingLayoutIsCorrect() {
+ void requireThatGroupingLayoutIsCorrect() {
assertLayout("all(group(artist) each(max(69) output(count()) each(output(summary()))))",
- "[[{ Attribute, result = [Count, Hits] }]]");
+ "[[{ Attribute, result = [Count, Hits] }]]");
assertLayout("all(group(artist) each(output(count()) all(group(album) each(output(count()) all(group(song) each(max(69) output(count()) each(output(summary()))))))))",
- "[[{ Attribute, result = [Count] }, { Attribute, result = [Count] }, { Attribute, result = [Count, Hits] }]]");
+ "[[{ Attribute, result = [Count] }, { Attribute, result = [Count] }, { Attribute, result = [Count, Hits] }]]");
assertLayout("all(group(artist) each(output(count())))",
- "[[{ Attribute, result = [Count] }]]");
+ "[[{ Attribute, result = [Count] }]]");
assertLayout("all(group(artist) order(sum(price)) each(output(count())))",
- "[[{ Attribute, result = [Count, Sum], order = [[1], [AggregationRef]] }]]");
+ "[[{ Attribute, result = [Count, Sum], order = [[1], [AggregationRef]] }]]");
assertLayout("all(group(artist) each(max(69) output(count()) each(output(summary(foo)))))",
- "[[{ Attribute, result = [Count, Hits] }]]");
+ "[[{ Attribute, result = [Count, Hits] }]]");
assertLayout("all(group(artist) each(output(count()) all(group(album) each(output(count())))))",
- "[[{ Attribute, result = [Count] }, { Attribute, result = [Count] }]]");
+ "[[{ Attribute, result = [Count] }, { Attribute, result = [Count] }]]");
assertLayout("all(group(artist) max(5) each(output(count()) all(group(album) max(3) each(output(count())))))",
- "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [4, 4], result = [Count] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [4, 4], result = [Count] }]]");
assertLayout("all(group(artist) max(5) each(output(count()) all(group(album) max(3) each(output(count())))))",
- "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [4, 4], result = [Count] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [4, 4], result = [Count] }]]");
assertLayout("all(group(foo) max(10) each(output(count()) all(group(bar) max(10) each(output(count())))))",
- "[[{ Attribute, max = [11, 11], result = [Count] }, { Attribute, max = [11, 11], result = [Count] }]]");
+ "[[{ Attribute, max = [11, 11], result = [Count] }, { Attribute, max = [11, 11], result = [Count] }]]");
assertLayout("all(group(a) max(5) each(max(69) output(count()) each(output(summary()))))",
- "[[{ Attribute, max = [6, 6], result = [Count, Hits] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count, Hits] }]]");
assertLayout("all(group(a) max(5) each(output(count()) all(group(b) max(5) each(max(69) output(count()) each(output(summary()))))))",
- "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count, Hits] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count, Hits] }]]");
assertLayout("all(group(a) max(5) each(output(count()) all(group(b) max(5) each(output(count()) all(group(c) max(5) each(max(69) output(count()) each(output(summary()))))))))",
- "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count, Hits] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count] }, { Attribute, max = [6, 6], result = [Count, Hits] }]]");
assertLayout("all(group(fixedwidth(n,3)) max(5) each(output(count()) all(group(a) max(2) each(output(count())))))",
- "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count] }]]");
+ "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count] }]]");
assertLayout("all(group(fixedwidth(n,3)) max(5) each(output(count()) all(group(a) max(2) each(output(count())))))",
- "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count] }]]");
+ "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count] }]]");
assertLayout("all(group(fixedwidth(n,3)) max(5) each(output(count()) all(group(a) max(2) each(max(1) output(count()) each(output(summary()))))))",
- "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count, Hits] }]]");
+ "[[{ FixedWidthBucket, max = [6, 6], result = [Count] }, { Attribute, max = [3, 3], result = [Count, Hits] }]]");
assertLayout("all(group(predefined(n,bucket(1,3),bucket(6,9))) each(output(count())))",
- "[[{ RangeBucketPreDef, result = [Count] }]]");
+ "[[{ RangeBucketPreDef, result = [Count] }]]");
assertLayout("all(group(predefined(f,bucket(1.0,3.0),bucket(6.0,9.0))) each(output(count())))",
- "[[{ RangeBucketPreDef, result = [Count] }]]");
+ "[[{ RangeBucketPreDef, result = [Count] }]]");
assertLayout("all(group(predefined(s,bucket(\"ab\",\"cd\"),bucket(\"ef\",\"gh\"))) each(output(count())))",
- "[[{ RangeBucketPreDef, result = [Count] }]]");
+ "[[{ RangeBucketPreDef, result = [Count] }]]");
assertLayout("all(group(a) max(5) each(output(count())))",
- "[[{ Attribute, max = [6, 6], result = [Count] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }]]");
assertLayout("all(group(a) max(5) each(output(count())))",
- "[[{ Attribute, max = [6, 6], result = [Count] }]]");
+ "[[{ Attribute, max = [6, 6], result = [Count] }]]");
assertLayout("all(max(9) all(group(a) each(output(count()))))",
- "[[{ Attribute, result = [Count] }]]");
+ "[[{ Attribute, result = [Count] }]]");
assertLayout("all(where(true) all(group(a) each(output(count()))))",
- "[[{ Attribute, result = [Count] }]]");
+ "[[{ Attribute, result = [Count] }]]");
assertLayout("all(group(a) order(sum(n)) each(output(count())))",
- "[[{ Attribute, result = [Count, Sum], order = [[1], [AggregationRef]] }]]");
+ "[[{ Attribute, result = [Count, Sum], order = [[1], [AggregationRef]] }]]");
assertLayout("all(group(a) max(2) each(output(count())))",
- "[[{ Attribute, max = [3, 3], result = [Count] }]]");
+ "[[{ Attribute, max = [3, 3], result = [Count] }]]");
assertLayout("all(group(a) max(2) precision(10) each(output(count())))",
- "[[{ Attribute, max = [3, 10], result = [Count] }]]");
+ "[[{ Attribute, max = [3, 10], result = [Count] }]]");
assertLayout("all(group(fixedwidth(a,1)) each(output(count())))",
- "[[{ FixedWidthBucket, result = [Count] }]]");
+ "[[{ FixedWidthBucket, result = [Count] }]]");
}
@Test
- public void requireThatAggregatorCanBeUsedAsArgumentToOrderByFunction() {
+ void requireThatAggregatorCanBeUsedAsArgumentToOrderByFunction() {
assertLayout("all(group(a) order(sum(price) * count()) each(output(count())))",
- "[[{ Attribute, result = [Count, Sum], order = [[1], [Multiply]] }]]");
+ "[[{ Attribute, result = [Count, Sum], order = [[1], [Multiply]] }]]");
assertLayout("all(group(a) order(sum(price) + 4) each(output(sum(price))))",
- "[[{ Attribute, result = [Sum], order = [[1], [Add]] }]]");
+ "[[{ Attribute, result = [Sum], order = [[1], [Add]] }]]");
assertLayout("all(group(a) order(sum(price) + 4, count()) each(output(sum(price))))",
- "[[{ Attribute, result = [Sum, Count], order = [[1, 2], [Add, AggregationRef]] }]]");
+ "[[{ Attribute, result = [Sum, Count], order = [[1, 2], [Add, AggregationRef]] }]]");
assertLayout("all(group(a) order(sum(price) + 4, -count()) each(output(sum(price))))",
- "[[{ Attribute, result = [Sum, Count], order = [[1, -2], [Add, AggregationRef]] }]]");
+ "[[{ Attribute, result = [Sum, Count], order = [[1, -2], [Add, AggregationRef]] }]]");
}
@Test
- public void requireThatSameAggregatorCanBeUsedMultipleTimes() {
+ void requireThatSameAggregatorCanBeUsedMultipleTimes() {
assertLayout("all(group(a) each(output(count() as(b),count() as(c))))",
- "[[{ Attribute, result = [Count, Count] }]]");
+ "[[{ Attribute, result = [Count, Count] }]]");
}
@Test
- public void requireThatSiblingAggregatorsCanNotShareSameLabel() {
+ void requireThatSiblingAggregatorsCanNotShareSameLabel() {
assertBuildFail("all(group(a) each(output(count(),count())))",
- "Can not use output label 'count()' for multiple siblings.");
+ "Can not use output label 'count()' for multiple siblings.");
assertBuildFail("all(group(a) each(output(count() as(b),count() as(b))))",
"Can not use output label 'b' for multiple siblings.");
}
@Test
- public void requireThatOrderByReusesOutputResults() {
+ void requireThatOrderByReusesOutputResults() {
assertLayout("all(group(a) order(count()) each(output(count())))",
"[[{ Attribute, result = [Count], order = [[1], [AggregationRef]] }]]");
assertLayout("all(group(a) order(count()) each(output(count() as(b))))",
@@ -463,40 +461,40 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatNoopBranchesArePruned() {
+ void requireThatNoopBranchesArePruned() {
assertLayout("all()", "[]");
assertLayout("all(group(a))", "[]");
assertLayout("all(group(a) each())", "[]");
String expectedA = "[{ Attribute, result = [Count] }]";
assertLayout("all(group(a) each(output(count())))",
- Arrays.asList(expectedA).toString());
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all()))",
- Arrays.asList(expectedA).toString());
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b))))",
- Arrays.asList(expectedA).toString());
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b) each())))",
- Arrays.asList(expectedA).toString());
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b) each())))",
- Arrays.asList(expectedA).toString());
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" +
- " each())",
- Arrays.asList(expectedA).toString());
+ " each())",
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" +
- " each(group(b)))",
- Arrays.asList(expectedA).toString());
+ " each(group(b)))",
+ Arrays.asList(expectedA).toString());
assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" +
- " each(group(b) each()))",
- Arrays.asList(expectedA).toString());
+ " each(group(b) each()))",
+ Arrays.asList(expectedA).toString());
String expectedB = "[{ Attribute }, { Attribute, result = [Count] }]";
assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" +
- " each(group(b) each(output(count()))))",
- Arrays.asList(expectedB, expectedA).toString());
+ " each(group(b) each(output(count()))))",
+ Arrays.asList(expectedB, expectedA).toString());
}
@Test
- public void requireThatAggregationLevelIsValidatedFails() {
+ void requireThatAggregationLevelIsValidatedFails() {
assertBuildFail("all(group(artist) output(sum(length)))",
"Expression 'length' not applicable for single group.");
assertBuild("all(group(artist) each(output(count())))");
@@ -506,46 +504,46 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatCountOnListOfGroupsIsValidated() {
+ void requireThatCountOnListOfGroupsIsValidated() {
assertBuild("all(group(artist) output(count()))");
assertBuild("all(group(artist) each(group(album) output(count())))");
}
@Test
- public void requireThatGroupByIsValidated() {
+ void requireThatGroupByIsValidated() {
assertBuild("all(group(artist) each(output(count())))");
assertBuildFail("all(group(sum(artist)) each(output(count())))",
- "Expression 'sum(artist)' not applicable for single hit.");
+ "Expression 'sum(artist)' not applicable for single hit.");
assertBuild("all(group(artist) each(group(album) each(output(count()))))");
assertBuildFail("all(group(artist) each(group(sum(album)) each(output(count()))))",
- "Expression 'sum(album)' not applicable for single hit.");
+ "Expression 'sum(album)' not applicable for single hit.");
}
@Test
- public void requireThatGroupingLevelIsValidated() {
+ void requireThatGroupingLevelIsValidated() {
assertBuild("all(group(artist))");
assertBuild("all(group(artist) each(group(album)))");
assertBuildFail("all(group(artist) all(group(sum(price))))",
- "Can not operate on list of list of groups.");
+ "Can not operate on list of list of groups.");
assertBuild("all(group(artist) each(group(album) each(group(song))))");
assertBuildFail("all(group(artist) each(group(album) all(group(sum(price)))))",
- "Can not operate on list of list of groups.");
+ "Can not operate on list of list of groups.");
}
@Test
- public void requireThatOrderByIsValidated() {
+ void requireThatOrderByIsValidated() {
assertBuildFail("all(order(length))",
- "Can not order single group content.");
+ "Can not order single group content.");
assertBuild("all(group(artist) order(sum(length)))");
assertBuildFail("all(group(artist) each(order(length)))",
- "Can not order single group content.");
+ "Can not order single group content.");
assertBuild("all(group(artist) each(group(album) order(sum(length))))");
assertBuildFail("all(group(artist) each(group(album) each(order(length))))",
- "Can not order single group content.");
+ "Can not order single group content.");
}
@Test
- public void requireThatOrderByHasCorrectReference() {
+ void requireThatOrderByHasCorrectReference() {
assertOrderBy("all(group(a) order(count()) each(output(count())))", "[[[1]]]");
assertOrderBy("all(group(a) order(-count()) each(output(count())))", "[[[-1]]]");
assertOrderBy("all(group(a) order(count()) each(output(count(),sum(b))))", "[[[1]]]");
@@ -565,23 +563,23 @@ public class RequestBuilderTestCase {
assertOrderBy("all(group(a) order(-count(),-sum(b)) each(output(sum(b), count())))", "[[[-1, -2]]]");
assertOrderBy("all(group(a) order(count()) each(output(count())) as(foo)" +
- " each(output(sum(b))) as(bar))",
- "[[[1]], [[1]]]");
+ " each(output(sum(b))) as(bar))",
+ "[[[1]], [[1]]]");
}
@Test
- public void requireThatWhereIsValidated() {
+ void requireThatWhereIsValidated() {
assertBuild("all(where(true))");
assertBuild("all(where($query))");
assertBuildFail("all(where(foo))",
- "Operation 'where' does not support 'foo'.");
+ "Operation 'where' does not support 'foo'.");
assertBuildFail("all(group(artist) where(true))",
- "Can not apply 'where' to non-root group.");
+ "Can not apply 'where' to non-root group.");
}
@Test
- public void requireThatRootAggregationCanBeTransformed() {
+ void requireThatRootAggregationCanBeTransformed() {
RequestTest test = new RequestTest();
test.expectedOutput = CountAggregationResult.class.getName();
test.request = "all(output(count()))";
@@ -590,68 +588,68 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatExpressionsCanBeLabeled() {
+ void requireThatExpressionsCanBeLabeled() {
assertLabel("all(group(a) each(output(count())))",
- "[[{ label = 'a', results = [count()] }]]");
+ "[[{ label = 'a', results = [count()] }]]");
assertLabel("all(group(a) each(output(count())) as(b))",
- "[[{ label = 'b', results = [count()] }]]");
+ "[[{ label = 'b', results = [count()] }]]");
assertLabel("all(group(a) each(group(b) each(output(count()))))",
- "[[{ label = 'a', results = [] }, { label = 'b', results = [count()] }]]");
+ "[[{ label = 'a', results = [] }, { label = 'b', results = [count()] }]]");
assertLabel("all(group(a) each(group(b) each(group(c) each(output(count())))))",
- "[[{ label = 'a', results = [] }, { label = 'b', results = [] }, { label = 'c', results = [count()] }]]");
+ "[[{ label = 'a', results = [] }, { label = 'b', results = [] }, { label = 'c', results = [count()] }]]");
assertBuildFail("all(group(a) each(output(count())) each(output(count())))",
- "Can not use group list label 'a' for multiple siblings.");
+ "Can not use group list label 'a' for multiple siblings.");
assertBuildFail("all(all(group(a) each(output(count())))" +
- " all(group(a) each(output(count()))))",
- "Can not use group list label 'a' for multiple siblings.");
+ " all(group(a) each(output(count()))))",
+ "Can not use group list label 'a' for multiple siblings.");
assertLabel("all(group(a) each(output(count())) as(a1)" +
- " each(output(count())) as(a2))",
- "[[{ label = 'a1', results = [count()] }], [{ label = 'a2', results = [count()] }]]");
+ " each(output(count())) as(a2))",
+ "[[{ label = 'a1', results = [count()] }], [{ label = 'a2', results = [count()] }]]");
assertLabel("all(group(a) each(all(group(b) each(output(count())))" +
- " all(group(c) each(output(count())))))",
- "[[{ label = 'a', results = [] }, { label = 'b', results = [count()] }], [{ label = 'a', results = [] }, { label = 'c', results = [count()] }]]");
+ " all(group(c) each(output(count())))))",
+ "[[{ label = 'a', results = [] }, { label = 'b', results = [count()] }], [{ label = 'a', results = [] }, { label = 'c', results = [count()] }]]");
assertLabel("all(group(a) each(group(b) each(output(count()))) as(a1)" +
- " each(group(b) each(output(count()))) as(a2))",
- "[[{ label = 'a1', results = [] }, { label = 'b', results = [count()] }], [{ label = 'a2', results = [] }, { label = 'b', results = [count()] }]]");
+ " each(group(b) each(output(count()))) as(a2))",
+ "[[{ label = 'a1', results = [] }, { label = 'b', results = [count()] }], [{ label = 'a2', results = [] }, { label = 'b', results = [count()] }]]");
assertLabel("all(group(a) each(group(b) each(group(c) each(output(count())))) as(a1)" +
- " each(group(b) each(group(e) each(output(count())))) as(a2))",
- "[[{ label = 'a1', results = [] }, { label = 'b', results = [] }, { label = 'c', results = [count()] }]," +
- " [{ label = 'a2', results = [] }, { label = 'b', results = [] }, { label = 'e', results = [count()] }]]");
+ " each(group(b) each(group(e) each(output(count())))) as(a2))",
+ "[[{ label = 'a1', results = [] }, { label = 'b', results = [] }, { label = 'c', results = [count()] }]," +
+ " [{ label = 'a2', results = [] }, { label = 'b', results = [] }, { label = 'e', results = [count()] }]]");
assertLabel("all(group(a) each(group(b) each(output(count())) as(b1)" +
- " each(output(count())) as(b2)))",
- "[[{ label = 'a', results = [] }, { label = 'b1', results = [count()] }]," +
- " [{ label = 'a', results = [] }, { label = 'b2', results = [count()] }]]");
+ " each(output(count())) as(b2)))",
+ "[[{ label = 'a', results = [] }, { label = 'b1', results = [count()] }]," +
+ " [{ label = 'a', results = [] }, { label = 'b2', results = [count()] }]]");
assertBuildFail("all(group(a) each(each(output(summary() as(foo)))))",
- "Can not label expression 'summary()'.");
+ "Can not label expression 'summary()'.");
assertLabel("all(group(foo) each(each(output(summary()))))",
- "[[{ label = 'foo', results = [hits] }]]");
+ "[[{ label = 'foo', results = [hits] }]]");
assertLabel("all(group(foo) each(each(output(summary())) as(bar)))",
- "[[{ label = 'foo', results = [bar] }]]");
+ "[[{ label = 'foo', results = [bar] }]]");
assertLabel("all(group(foo) each(each(output(summary())) as(bar)) as(baz))",
- "[[{ label = 'baz', results = [bar] }]]");
+ "[[{ label = 'baz', results = [bar] }]]");
assertLabel("all(group(foo) each(each(output(summary())) as(bar)" +
- " each(output(summary())) as(baz)))",
- "[[{ label = 'foo', results = [bar] }]," +
- " [{ label = 'foo', results = [baz] }]]");
+ " each(output(summary())) as(baz)))",
+ "[[{ label = 'foo', results = [bar] }]," +
+ " [{ label = 'foo', results = [baz] }]]");
assertLabel("all(group(foo) each(each(output(summary())))" +
- " each(each(output(summary()))) as(bar))",
- "[[{ label = 'bar', results = [hits] }]," +
- " [{ label = 'foo', results = [hits] }]]");
+ " each(each(output(summary()))) as(bar))",
+ "[[{ label = 'bar', results = [hits] }]," +
+ " [{ label = 'foo', results = [hits] }]]");
}
@Test
- public void requireThatOrderByResultsAreNotLabeled() {
+ void requireThatOrderByResultsAreNotLabeled() {
assertLabel("all(group(a) each(output(min(b), max(b), avg(b))))",
- "[[{ label = 'a', results = [min(b), max(b), avg(b)] }]]");
+ "[[{ label = 'a', results = [min(b), max(b), avg(b)] }]]");
assertLabel("all(group(a) order(min(b)) each(output(max(b), avg(b))))",
- "[[{ label = 'a', results = [max(b), avg(b), null] }]]");
+ "[[{ label = 'a', results = [max(b), avg(b), null] }]]");
assertLabel("all(group(a) order(min(b), max(b)) each(output(avg(b))))",
- "[[{ label = 'a', results = [avg(b), null, null] }]]");
+ "[[{ label = 'a', results = [avg(b), null, null] }]]");
}
@Test
- public void requireThatTimeZoneIsAppliedToTimeFunctions() {
+ void requireThatTimeZoneIsAppliedToTimeFunctions() {
for (String timePart : Arrays.asList("dayofmonth", "dayofweek", "dayofyear", "hourofday",
"minuteofhour", "monthofyear", "secondofminute", "year"))
{
@@ -665,17 +663,17 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatTimeDateIsExpanded() {
+ void requireThatTimeDateIsExpanded() {
RequestTest test = new RequestTest();
test.expectedOutput = new StrCatFunctionNode()
.addArg(new ToStringFunctionNode(new TimeStampFunctionNode(new AttributeNode("foo"),
- TimeStampFunctionNode.TimePart.Year, true)))
+ TimeStampFunctionNode.TimePart.Year, true)))
.addArg(new ConstantNode(new StringResultNode("-")))
.addArg(new ToStringFunctionNode(new TimeStampFunctionNode(new AttributeNode("foo"),
- TimeStampFunctionNode.TimePart.Month, true)))
+ TimeStampFunctionNode.TimePart.Month, true)))
.addArg(new ConstantNode(new StringResultNode("-")))
.addArg(new ToStringFunctionNode(new TimeStampFunctionNode(new AttributeNode("foo"),
- TimeStampFunctionNode.TimePart.MonthDay, true)))
+ TimeStampFunctionNode.TimePart.MonthDay, true)))
.toString();
test.request = "all(output(avg(time.date(foo))))";
test.outputWriter = (groupingList, transform) -> groupingList.get(0).getRoot().getAggregationResults().get(0).getExpression().toString();
@@ -683,7 +681,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatNowIsResolvedToCurrentTime() {
+ void requireThatNowIsResolvedToCurrentTime() {
RequestTest test = new RequestTest();
test.expectedOutput = Boolean.toString(true);
test.request = "all(output(avg(now() - foo)))";
@@ -693,8 +691,8 @@ public class RequestBuilderTestCase {
@Override
public String write(List<Grouping> groupingList, GroupingTransform transform) {
AddFunctionNode add =
- (AddFunctionNode)groupingList.get(0).getRoot().getAggregationResults().get(0).getExpression();
- long nowValue = ((ConstantNode)add.getArg(0)).getValue().getInteger();
+ (AddFunctionNode) groupingList.get(0).getRoot().getAggregationResults().get(0).getExpression();
+ long nowValue = ((ConstantNode) add.getArg(0)).getValue().getInteger();
boolean preCond = nowValue >= (before / 1000);
long after = System.currentTimeMillis();
boolean postCond = nowValue <= (after / 1000);
@@ -706,7 +704,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatAttributeMapLookupNodeIsCreatedFromKey() {
+ void requireThatAttributeMapLookupNodeIsCreatedFromKey() {
RequestTest test = new RequestTest();
test.expectedOutput = AttributeMapLookupNode.fromKey("map{\"my_key\"}", "map.key", "map.value", "my_key").toString();
test.request = "all(group(map{\"my_key\"}) each(output(count())))";
@@ -715,7 +713,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void requireThatAttributeMapLookupNodeIsCreatedFromKeySourceAttribute() {
+ void requireThatAttributeMapLookupNodeIsCreatedFromKeySourceAttribute() {
RequestTest test = new RequestTest();
test.expectedOutput = AttributeMapLookupNode.fromKeySourceAttribute("map{attribute(key_source)}", "map.key", "map.value", "key_source").toString();
test.request = "all(group(map{attribute(key_source)}) each(output(count())))";
@@ -724,7 +722,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void require_that_default_max_values_from_request_builder_restricts_max_groups_and_hits() {
+ void require_that_default_max_values_from_request_builder_restricts_max_groups_and_hits() {
int defaultMaxHits = 19;
int defaultMaxGroups = 7;
RequestBuilder builder = new RequestBuilder(0)
@@ -735,12 +733,12 @@ public class RequestBuilderTestCase {
List<Grouping> requests = builder.getRequestList();
assertEquals(defaultMaxGroups + 1, requests.get(0).getLevels().get(0).getMaxGroups());
HitsAggregationResult hitsAggregation =
- (HitsAggregationResult)requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
+ (HitsAggregationResult) requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
assertEquals(defaultMaxHits + 1, hitsAggregation.getMaxHits());
}
@Test
- public void require_that_default_max_values_from_request_builder_respects_explicit_max() {
+ void require_that_default_max_values_from_request_builder_respects_explicit_max() {
{
RequestBuilder builder = new RequestBuilder(0)
.setDefaultMaxGroups(7)
@@ -750,7 +748,7 @@ public class RequestBuilderTestCase {
List<Grouping> requests = builder.getRequestList();
assertEquals(12, requests.get(0).getLevels().get(0).getMaxGroups());
HitsAggregationResult hitsAggregation =
- (HitsAggregationResult)requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
+ (HitsAggregationResult) requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
assertEquals(22, hitsAggregation.getMaxHits());
}
{
@@ -762,21 +760,21 @@ public class RequestBuilderTestCase {
List<Grouping> requests = builder.getRequestList();
assertEquals(-1, requests.get(0).getLevels().get(0).getMaxGroups());
HitsAggregationResult hitsAggregation =
- (HitsAggregationResult)requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
+ (HitsAggregationResult) requests.get(0).getLevels().get(0).getGroupPrototype().getAggregationResults().get(0);
assertEquals(-1, hitsAggregation.getMaxHits());
}
}
@Test
- public void require_that_total_groups_and_summaries_calculation_is_correct() {
+ void require_that_total_groups_and_summaries_calculation_is_correct() {
assertTotalGroupsAndSummaries(5, "all(group(a) max(5) each(output(count())))");
- assertTotalGroupsAndSummaries(5+5*7, "all(group(a) max(5) each(max(7) each(output(summary()))))");
- assertTotalGroupsAndSummaries(3+3*5+3*5*7+3*5*7*11,
+ assertTotalGroupsAndSummaries(5 + 5 * 7, "all(group(a) max(5) each(max(7) each(output(summary()))))");
+ assertTotalGroupsAndSummaries(3 + 3 * 5 + 3 * 5 * 7 + 3 * 5 * 7 * 11,
"all( group(a) max(3) each(output(count())" +
- " all(group(b) max(5) each(output(count())" +
- " all(group(c) max(7) each(max(11) output(count())" +
- " each(output(summary()))))))))");
- assertTotalGroupsAndSummaries(2*(3+3*5),
+ " all(group(b) max(5) each(output(count())" +
+ " all(group(c) max(7) each(max(11) output(count())" +
+ " each(output(summary()))))))))");
+ assertTotalGroupsAndSummaries(2 * (3 + 3 * 5),
"all(" +
" all(group(a) max(3) each(output(count()) max(5) each(output(summary())))) " +
" all(group(b) max(3) each(output(count()) max(5) each(output(summary())))))");
@@ -784,24 +782,24 @@ public class RequestBuilderTestCase {
}
@Test
- public void require_that_total_groups_restriction_can_be_disabled() {
- assertTotalGroupsAndSummaries(3+3*5+3*5*7+3*5*7*100,
- -1, // disable
- "all( group(a) max(3) each(output(count())" +
- " all(group(b) max(5) each(output(count())" +
- " all(group(c) max(7) each(max(100) output(count())" +
- " each(output(summary()))))))))");
+ void require_that_total_groups_restriction_can_be_disabled() {
+ assertTotalGroupsAndSummaries(3 + 3 * 5 + 3 * 5 * 7 + 3 * 5 * 7 * 100,
+ -1, // disable
+ "all( group(a) max(3) each(output(count())" +
+ " all(group(b) max(5) each(output(count())" +
+ " all(group(c) max(7) each(max(100) output(count())" +
+ " each(output(summary()))))))))");
}
@Test
- public void require_that_unbounded_queries_fails_when_global_max_is_enabled() {
+ void require_that_unbounded_queries_fails_when_global_max_is_enabled() {
assertQueryFailsOnGlobalMax(4, "all(group(a) max(5) each(output(count())))", "5 > 4");
assertQueryFailsOnGlobalMax(Long.MAX_VALUE, "all(group(a) each(output(count())))", "unbounded number of groups");
assertQueryFailsOnGlobalMax(Long.MAX_VALUE, "all(group(a) max(5) each(each(output(summary()))))", "unbounded number of summaries");
}
@Test
- public void require_that_default_precision_factor_overrides_implicit_precision() {
+ void require_that_default_precision_factor_overrides_implicit_precision() {
int factor = 3;
RequestBuilder builder = new RequestBuilder(0)
.setDefaultPrecisionFactor(factor)
@@ -811,7 +809,7 @@ public class RequestBuilderTestCase {
}
@Test
- public void require_that_explicit_precision_has_precedence() {
+ void require_that_explicit_precision_has_precedence() {
RequestBuilder builder = new RequestBuilder(0)
.setDefaultPrecisionFactor(3)
.setRootOperation(GroupingOperation.fromString("all(group(foo)max(5)precision(10)each(output(count())))"));
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 3bc5a7c245c..019a022b7e6 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
@@ -13,12 +13,12 @@ import com.yahoo.search.result.Relevance;
import com.yahoo.searchlib.aggregation.*;
import com.yahoo.searchlib.aggregation.hll.SparseSketch;
import com.yahoo.searchlib.expression.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -29,28 +29,28 @@ public class ResultBuilderTestCase {
private static final int ROOT_IDX = 0;
@Test
- public void requireThatAllGroupIdsCanBeConverted() {
+ void requireThatAllGroupIdsCanBeConverted() {
assertGroupId("group:6.9", new FloatResultNode(6.9));
assertGroupId("group:69", new IntegerResultNode(69));
assertGroupId("group:null", new NullResultNode());
- assertGroupId("group:[6, 9]", new RawResultNode(new byte[] { 6, 9 }));
+ assertGroupId("group:[6, 9]", new RawResultNode(new byte[]{6, 9}));
assertGroupId("group:a", new StringResultNode("a"));
assertGroupId("group:6.9:9.6", new FloatBucketResultNode(6.9, 9.6));
assertGroupId("group:6:9", new IntegerBucketResultNode(6, 9));
assertGroupId("group:a:b", new StringBucketResultNode("a", "b"));
- assertGroupId("group:[6, 9]:[9, 6]", new RawBucketResultNode(new RawResultNode(new byte[] { 6, 9 }),
- new RawResultNode(new byte[] { 9, 6 })));
+ assertGroupId("group:[6, 9]:[9, 6]", new RawBucketResultNode(new RawResultNode(new byte[]{6, 9}),
+ new RawResultNode(new byte[]{9, 6})));
}
@Test
- public void requireThatUnknownGroupIdThrows() {
+ void requireThatUnknownGroupIdThrows() {
assertBuildFail("all(group(a) each(output(count())))",
- Arrays.asList(newGrouping(new Group().setTag(2).setId(new MyResultNode()))),
- "com.yahoo.search.grouping.vespa.ResultBuilderTestCase$MyResultNode");
+ Arrays.asList(newGrouping(new Group().setTag(2).setId(new MyResultNode()))),
+ "com.yahoo.search.grouping.vespa.ResultBuilderTestCase$MyResultNode");
}
@Test
- public void requireThatAllExpressionNodesCanBeConverted() {
+ void requireThatAllExpressionNodesCanBeConverted() {
assertResult("0", new AverageAggregationResult(new IntegerResultNode(6), 9));
assertResult("69", new CountAggregationResult(69));
assertResult("69", new MaxAggregationResult(new IntegerResultNode(69)));
@@ -61,89 +61,89 @@ public class ResultBuilderTestCase {
}
@Test
- public void requireThatUnknownExpressionNodeThrows() {
+ void requireThatUnknownExpressionNodeThrows() {
assertBuildFail("all(group(a) each(output(count())))",
- Arrays.asList(newGrouping(newGroup(2, 2, new MyAggregationResult().setTag(3)))),
- "com.yahoo.search.grouping.vespa.ResultBuilderTestCase$MyAggregationResult");
+ Arrays.asList(newGrouping(newGroup(2, 2, new MyAggregationResult().setTag(3)))),
+ "com.yahoo.search.grouping.vespa.ResultBuilderTestCase$MyAggregationResult");
}
@Test
- public void requireThatRootResultsAreIncluded() {
+ void requireThatRootResultsAreIncluded() {
assertLayout("all(output(count()))",
- new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
- "RootGroup{id=group:root, count()=69}[]");
+ new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
+ "RootGroup{id=group:root, count()=69}[]");
}
@Test
- public void requireThatRootResultsAreIncludedUsingExpressionCountAggregationResult() {
+ void requireThatRootResultsAreIncludedUsingExpressionCountAggregationResult() {
assertLayout("all(group(a) output(count()))",
new Grouping().setRoot(newGroup(1, new ExpressionCountAggregationResult(new SparseSketch(), sketch -> 69).setTag(2))),
"RootGroup{id=group:root, count()=69}[]");
}
@Test
- public void requireThatNestedGroupingResultsCanBeTransformed() {
+ void requireThatNestedGroupingResultsCanBeTransformed() {
Grouping grouping = new Grouping()
.setRoot(new Group()
- .setTag(1)
- .addChild(new Group()
- .setTag(2)
- .setId(new StringResultNode("foo"))
- .addAggregationResult(new CountAggregationResult(10).setTag(3))
- .addChild(new Group()
- .setTag(4)
- .setId(new StringResultNode("foo_a"))
- .addAggregationResult(new CountAggregationResult(15)
- .setTag(5)))
- .addChild(new Group()
- .setTag(4)
- .setId(new StringResultNode("foo_b"))
- .addAggregationResult(new CountAggregationResult(16)
- .setTag(5))))
- .addChild(new Group()
- .setTag(2)
- .setId(new StringResultNode("bar"))
- .addAggregationResult(new CountAggregationResult(20).setTag(3))
- .addChild(new Group()
- .setTag(4)
- .setId(new StringResultNode("bar_a"))
- .addAggregationResult(
- new CountAggregationResult(25)
- .setTag(5)))
- .addChild(new Group()
- .setTag(4)
- .setId(new StringResultNode("bar_b"))
- .addAggregationResult(
- new CountAggregationResult(26)
- .setTag(5)))));
+ .setTag(1)
+ .addChild(new Group()
+ .setTag(2)
+ .setId(new StringResultNode("foo"))
+ .addAggregationResult(new CountAggregationResult(10).setTag(3))
+ .addChild(new Group()
+ .setTag(4)
+ .setId(new StringResultNode("foo_a"))
+ .addAggregationResult(new CountAggregationResult(15)
+ .setTag(5)))
+ .addChild(new Group()
+ .setTag(4)
+ .setId(new StringResultNode("foo_b"))
+ .addAggregationResult(new CountAggregationResult(16)
+ .setTag(5))))
+ .addChild(new Group()
+ .setTag(2)
+ .setId(new StringResultNode("bar"))
+ .addAggregationResult(new CountAggregationResult(20).setTag(3))
+ .addChild(new Group()
+ .setTag(4)
+ .setId(new StringResultNode("bar_a"))
+ .addAggregationResult(
+ new CountAggregationResult(25)
+ .setTag(5)))
+ .addChild(new Group()
+ .setTag(4)
+ .setId(new StringResultNode("bar_b"))
+ .addAggregationResult(
+ new CountAggregationResult(26)
+ .setTag(5)))));
assertLayout("all(group(artist) max(5) each(output(count() as(baz)) all(group(album) " +
- "max(5) each(output(count() as(cox))) as(group_album))) as(group_artist))",
- grouping,
- "RootGroup{id=group:root}[GroupList{label=group_artist}[" +
- "Group{id=group:foo, baz=10}[GroupList{label=group_album}[Group{id=group:foo_a, cox=15}[], Group{id=group:foo_b, cox=16}[]]], " +
- "Group{id=group:bar, baz=20}[GroupList{label=group_album}[Group{id=group:bar_a, cox=25}[], Group{id=group:bar_b, cox=26}[]]]]]");
+ "max(5) each(output(count() as(cox))) as(group_album))) as(group_artist))",
+ grouping,
+ "RootGroup{id=group:root}[GroupList{label=group_artist}[" +
+ "Group{id=group:foo, baz=10}[GroupList{label=group_album}[Group{id=group:foo_a, cox=15}[], Group{id=group:foo_b, cox=16}[]]], " +
+ "Group{id=group:bar, baz=20}[GroupList{label=group_album}[Group{id=group:bar_a, cox=25}[], Group{id=group:bar_b, cox=26}[]]]]]");
}
@Test
- public void requireThatParallelResultsAreTransformed() {
+ void requireThatParallelResultsAreTransformed() {
assertBuild("all(group(foo) each(output(count())) as(bar) each(output(count())) as(baz))",
- Arrays.asList(new Grouping().setRoot(newGroup(1, 0)),
- new Grouping().setRoot(newGroup(1, 0))));
+ Arrays.asList(new Grouping().setRoot(newGroup(1, 0)),
+ new Grouping().setRoot(newGroup(1, 0))));
assertBuildFail("all(group(foo) each(output(count())) as(bar) each(output(count())) as(baz))",
- Arrays.asList(new Grouping().setRoot(newGroup(2)),
- new Grouping().setRoot(newGroup(3))),
- "Expected 1 group, got 2.");
+ Arrays.asList(new Grouping().setRoot(newGroup(2)),
+ new Grouping().setRoot(newGroup(3))),
+ "Expected 1 group, got 2.");
}
@Test
- public void requireThatTagsAreHandledCorrectly() {
+ void requireThatTagsAreHandledCorrectly() {
assertBuild("all(group(a) each(output(count())))",
Arrays.asList(newGrouping(
newGroup(7, new CountAggregationResult(0)))));
}
@Test
- public void requireThatEmptyBranchesArePruned() {
+ void requireThatEmptyBranchesArePruned() {
assertBuildFail("all()", Collections.<Grouping>emptyList(), "Expected 1 group, got 0.");
assertBuildFail("all(group(a))", Collections.<Grouping>emptyList(), "Expected 1 group, got 0.");
assertBuildFail("all(group(a) each())", Collections.<Grouping>emptyList(), "Expected 1 group, got 0.");
@@ -156,71 +156,71 @@ public class ResultBuilderTestCase {
assertLayout("all(group(a) each(output(count()) all(group(b) each())))", grouping, expectedOutput);
assertLayout("all(group(a) each(output(count()) all(group(b) each())))", grouping, expectedOutput);
assertLayout("all(group(a) each(output(count()) all(group(b) each()))" +
- " each() as(foo))", grouping, expectedOutput);
+ " each() as(foo))", grouping, expectedOutput);
assertLayout("all(group(a) each(output(count()) all(group(b) each()))" +
- " each(group(b)) as(foo))", grouping, expectedOutput);
+ " each(group(b)) as(foo))", grouping, expectedOutput);
assertLayout("all(group(a) each(output(count()) all(group(b) each()))" +
- " each(group(b) each()) as(foo))", grouping, expectedOutput);
+ " each(group(b) each()) as(foo))", grouping, expectedOutput);
}
@Test
- public void requireThatGroupListsAreLabeled() {
+ void requireThatGroupListsAreLabeled() {
assertLayout("all(group(a) each(output(count())))",
- newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
- "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, count()=69}[]]]");
+ newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
+ "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, count()=69}[]]]");
assertLayout("all(group(a) each(output(count())) as(bar))",
- newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
- "RootGroup{id=group:root}[GroupList{label=bar}[Group{id=group:2, count()=69}[]]]");
+ newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
+ "RootGroup{id=group:root}[GroupList{label=bar}[Group{id=group:2, count()=69}[]]]");
}
@Test
- public void requireThatHitListsAreLabeled() {
+ void requireThatHitListsAreLabeled() {
assertLayout("all(group(foo) each(each(output(summary()))))",
- newGrouping(newGroup(2, newHitList(3, 2))),
- "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
- "HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
+ newGrouping(newGroup(2, newHitList(3, 2))),
+ "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
+ "HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
assertLayout("all(group(foo) each(each(output(summary())) as(bar)))",
- newGrouping(newGroup(2, newHitList(3, 2))),
- "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
- "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
+ newGrouping(newGroup(2, newHitList(3, 2))),
+ "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
+ "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
assertLayout("all(group(foo) each(each(output(summary())) as(bar)) as(baz))",
- newGrouping(newGroup(2, newHitList(3, 2))),
- "RootGroup{id=group:root}[GroupList{label=baz}[Group{id=group:2}[" +
- "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
+ newGrouping(newGroup(2, newHitList(3, 2))),
+ "RootGroup{id=group:root}[GroupList{label=baz}[Group{id=group:2}[" +
+ "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
assertLayout("all(group(foo) each(each(output(summary())) as(bar)" +
- " each(output(summary())) as(baz)))",
- Arrays.asList(newGrouping(newGroup(2, newHitList(3, 2))),
- newGrouping(newGroup(2, newHitList(4, 2)))),
- "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
- "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}], " +
- "HitList{label=baz}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
+ " each(output(summary())) as(baz)))",
+ Arrays.asList(newGrouping(newGroup(2, newHitList(3, 2))),
+ newGrouping(newGroup(2, newHitList(4, 2)))),
+ "RootGroup{id=group:root}[GroupList{label=foo}[Group{id=group:2}[" +
+ "HitList{label=bar}[Hit{id=hit:1}, Hit{id=hit:2}], " +
+ "HitList{label=baz}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
assertLayout("all(group(foo) each(each(output(summary())))" +
- " each(each(output(summary()))) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, newHitList(3, 2))),
- newGrouping(newGroup(4, newHitList(5, 2)))),
- "RootGroup{id=group:root}[" +
- "GroupList{label=foo}[Group{id=group:2}[HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]], " +
- "GroupList{label=bar}[Group{id=group:4}[HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
+ " each(each(output(summary()))) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, newHitList(3, 2))),
+ newGrouping(newGroup(4, newHitList(5, 2)))),
+ "RootGroup{id=group:root}[" +
+ "GroupList{label=foo}[Group{id=group:2}[HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]], " +
+ "GroupList{label=bar}[Group{id=group:4}[HitList{label=hits}[Hit{id=hit:1}, Hit{id=hit:2}]]]]");
}
@Test
- public void requireThatOutputsAreLabeled() {
+ void requireThatOutputsAreLabeled() {
assertLayout("all(output(count()))",
- new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
- "RootGroup{id=group:root, count()=69}[]");
+ new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
+ "RootGroup{id=group:root, count()=69}[]");
assertLayout("all(output(count() as(foo)))",
- new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
- "RootGroup{id=group:root, foo=69}[]");
+ new Grouping().setRoot(newGroup(1, new CountAggregationResult(69).setTag(2))),
+ "RootGroup{id=group:root, foo=69}[]");
assertLayout("all(group(a) each(output(count())))",
- newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
- "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, count()=69}[]]]");
+ newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
+ "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, count()=69}[]]]");
assertLayout("all(group(a) each(output(count() as(foo))))",
- newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
- "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, foo=69}[]]]");
+ newGrouping(newGroup(2, new CountAggregationResult(69).setTag(3))),
+ "RootGroup{id=group:root}[GroupList{label=a}[Group{id=group:2, foo=69}[]]]");
}
@Test
- public void requireThatExpressionCountCanUseExactGroupCount() {
+ void requireThatExpressionCountCanUseExactGroupCount() {
Group root1 = newGroup(1, new ExpressionCountAggregationResult(new SparseSketch(), sketch -> 42).setTag(2));
Grouping grouping1 = new Grouping().setRoot(root1);
@@ -260,35 +260,35 @@ public class ResultBuilderTestCase {
@Test
- public void requireThatResultContinuationContainsCurrentPages() {
+ void requireThatResultContinuationContainsCurrentPages() {
String request = "all(group(a) max(2) each(output(count())))";
Grouping result = newGrouping(newGroup(2, 1, new CountAggregationResult(1)),
- newGroup(2, 2, new CountAggregationResult(2)),
- newGroup(2, 3, new CountAggregationResult(3)),
- newGroup(2, 4, new CountAggregationResult(4)));
+ newGroup(2, 2, new CountAggregationResult(2)),
+ newGroup(2, 3, new CountAggregationResult(3)),
+ newGroup(2, 4, new CountAggregationResult(4)));
assertResultCont(request, result, newOffset(newResultId(0), 2, 0), "[]");
assertResultCont(request, result, newOffset(newResultId(0), 2, 1), "[0=1]");
assertResultCont(request, result, newOffset(newResultId(0), 2, 2), "[0=2]");
assertResultCont(request, result, newOffset(newResultId(0), 2, 3), "[0=3]");
assertResultCont("all(group(a) max(2) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
- newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
- "[]");
+ " each(output(count())) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
+ newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
+ "[]");
assertResultCont("all(group(a) max(2) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
- newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
- newOffset(newResultId(0), 2, 1),
- "[0=1]");
+ " each(output(count())) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
+ newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
+ newOffset(newResultId(0), 2, 1),
+ "[0=1]");
assertResultCont("all(group(a) max(2) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
- newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
- newComposite(newOffset(newResultId(0), 2, 2),
- newOffset(newResultId(1), 4, 1)),
- "[0=2, 1=1]");
+ " each(output(count())) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1))),
+ newGrouping(newGroup(4, 2, new CountAggregationResult(4)))),
+ newComposite(newOffset(newResultId(0), 2, 2),
+ newOffset(newResultId(1), 4, 1)),
+ "[0=2, 1=1]");
request = "all(group(a) each(max(2) each(output(summary()))))";
result = newGrouping(newGroup(2, newHitList(3, 4)));
@@ -298,436 +298,436 @@ public class ResultBuilderTestCase {
assertResultCont(request, result, newOffset(newResultId(0, 0, 0), 3, 3), "[0.0.0=3]");
assertResultCont("all(group(a) each(max(2) each(output(summary()))) as(foo)" +
- " each(max(2) each(output(summary()))) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
- newGrouping(newGroup(4, newHitList(5, 4)))),
- "[]");
+ " each(max(2) each(output(summary()))) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
+ newGrouping(newGroup(4, newHitList(5, 4)))),
+ "[]");
assertResultCont("all(group(a) each(max(2) each(output(summary()))) as(foo)" +
- " each(max(2) each(output(summary()))) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
- newGrouping(newGroup(4, newHitList(5, 4)))),
- newOffset(newResultId(0, 0, 0), 3, 1),
- "[0.0.0=1]");
+ " each(max(2) each(output(summary()))) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
+ newGrouping(newGroup(4, newHitList(5, 4)))),
+ newOffset(newResultId(0, 0, 0), 3, 1),
+ "[0.0.0=1]");
assertResultCont("all(group(a) each(max(2) each(output(summary()))) as(foo)" +
- " each(max(2) each(output(summary()))) as(bar))",
- Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
- newGrouping(newGroup(4, newHitList(5, 4)))),
- newComposite(newOffset(newResultId(0, 0, 0), 3, 2),
- newOffset(newResultId(1, 0, 0), 5, 1)),
- "[0.0.0=2, 1.0.0=1]");
+ " each(max(2) each(output(summary()))) as(bar))",
+ Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
+ newGrouping(newGroup(4, newHitList(5, 4)))),
+ newComposite(newOffset(newResultId(0, 0, 0), 3, 2),
+ newOffset(newResultId(1, 0, 0), 5, 1)),
+ "[0.0.0=2, 1.0.0=1]");
}
@Test
- public void requireThatGroupListContinuationsAreNotCreatedWhenUnlessMaxIsSet() {
+ void requireThatGroupListContinuationsAreNotCreatedWhenUnlessMaxIsSet() {
assertContinuation("all(group(a) each(output(count())))",
- newGrouping(newGroup(2, 1, new CountAggregationResult(1)),
- newGroup(2, 2, new CountAggregationResult(2)),
- newGroup(2, 3, new CountAggregationResult(3)),
- newGroup(2, 4, new CountAggregationResult(4))),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:1', {}, [] }, { 'group:2', {}, [] }, { 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
+ newGrouping(newGroup(2, 1, new CountAggregationResult(1)),
+ newGroup(2, 2, new CountAggregationResult(2)),
+ newGroup(2, 3, new CountAggregationResult(3)),
+ newGroup(2, 4, new CountAggregationResult(4))),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:1', {}, [] }, { 'group:2', {}, [] }, { 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
}
@Test
- public void requireThatGroupListContinuationsCanBeSet() {
+ void requireThatGroupListContinuationsCanBeSet() {
String request = "all(group(a) max(2) each(output(count())))";
Grouping result = newGrouping(newGroup(2, 1, new CountAggregationResult(1)),
- newGroup(2, 2, new CountAggregationResult(2)),
- newGroup(2, 3, new CountAggregationResult(3)),
- newGroup(2, 4, new CountAggregationResult(4)));
+ newGroup(2, 2, new CountAggregationResult(2)),
+ newGroup(2, 3, new CountAggregationResult(3)),
+ newGroup(2, 4, new CountAggregationResult(4)));
assertContinuation(request, result, newOffset(newResultId(0), 2, 0),
- "{ 'group:root', {}, [{ 'grouplist:a', {next=2}, [" +
- "{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {next=2}, [" +
+ "{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0), 2, 1),
- "{ 'group:root', {}, [{ 'grouplist:a', {next=3, prev=0}, [" +
- "{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {next=3, prev=0}, [" +
+ "{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0), 2, 2),
- "{ 'group:root', {}, [{ 'grouplist:a', {prev=0}, [" +
- "{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {prev=0}, [" +
+ "{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0), 2, 3),
- "{ 'group:root', {}, [{ 'grouplist:a', {prev=1}, [" +
- "{ 'group:4', {}, [] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {prev=1}, [" +
+ "{ 'group:4', {}, [] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0), 2, 4),
- "{ 'group:root', {}, [{ 'grouplist:a', {prev=2}, [" +
- "] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {prev=2}, [" +
+ "] }] }");
assertContinuation(request, result, newOffset(newResultId(0), 2, 5),
- "{ 'group:root', {}, [{ 'grouplist:a', {prev=2}, [" +
- "] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {prev=2}, [" +
+ "] }] }");
}
@Test
- public void requireThatGroupListContinuationsCanBeSetInSiblingGroups() {
+ void requireThatGroupListContinuationsCanBeSetInSiblingGroups() {
String request = "all(group(a) each(group(b) max(2) each(output(count()))))";
Grouping result = newGrouping(newGroup(2, 201,
- newGroup(3, 301, new CountAggregationResult(1)),
- newGroup(3, 302, new CountAggregationResult(2)),
- newGroup(3, 303, new CountAggregationResult(3)),
- newGroup(3, 304, new CountAggregationResult(4))),
- newGroup(2, 202,
- newGroup(3, 305, new CountAggregationResult(5)),
- newGroup(3, 306, new CountAggregationResult(6)),
- newGroup(3, 307, new CountAggregationResult(7)),
- newGroup(3, 308, new CountAggregationResult(8))));
+ newGroup(3, 301, new CountAggregationResult(1)),
+ newGroup(3, 302, new CountAggregationResult(2)),
+ newGroup(3, 303, new CountAggregationResult(3)),
+ newGroup(3, 304, new CountAggregationResult(4))),
+ newGroup(2, 202,
+ newGroup(3, 305, new CountAggregationResult(5)),
+ newGroup(3, 306, new CountAggregationResult(6)),
+ newGroup(3, 307, new CountAggregationResult(7)),
+ newGroup(3, 308, new CountAggregationResult(8))));
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 0),
- newOffset(newResultId(0, 1, 0), 2, 5)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [{ 'group:301', {}, [] }, { 'group:302', {}, [] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 5)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [{ 'group:301', {}, [] }, { 'group:302', {}, [] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 1),
- newOffset(newResultId(0, 1, 0), 2, 4)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=3, prev=0}, [{ 'group:302', {}, [] }, { 'group:303', {}, [] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 4)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=3, prev=0}, [{ 'group:302', {}, [] }, { 'group:303', {}, [] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 2),
- newOffset(newResultId(0, 1, 0), 2, 3)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [{ 'group:303', {}, [] }, { 'group:304', {}, [] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {prev=1}, [{ 'group:308', {}, [] }] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 3)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [{ 'group:303', {}, [] }, { 'group:304', {}, [] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {prev=1}, [{ 'group:308', {}, [] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 3),
- newOffset(newResultId(0, 1, 0), 2, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=1}, [{ 'group:304', {}, [] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {prev=0}, [{ 'group:307', {}, [] }, { 'group:308', {}, [] }] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 2)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=1}, [{ 'group:304', {}, [] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {prev=0}, [{ 'group:307', {}, [] }, { 'group:308', {}, [] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 4),
- newOffset(newResultId(0, 1, 0), 2, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=2}, [] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [{ 'group:306', {}, [] }, { 'group:307', {}, [] }] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=2}, [] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [{ 'group:306', {}, [] }, { 'group:307', {}, [] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 2, 5),
- newOffset(newResultId(0, 1, 0), 2, 0)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=2}, [] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [{ 'group:305', {}, [] }, { 'group:306', {}, [] }] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 2, 0)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=2}, [] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [{ 'group:305', {}, [] }, { 'group:306', {}, [] }] }] }] }] }");
}
@Test
- public void requireThatGroupListContinuationsCanBeSetInSiblingGroupLists() {
+ void requireThatGroupListContinuationsCanBeSetInSiblingGroupLists() {
String request = "all(group(a) max(2) each(output(count())) as(foo)" +
- " each(output(count())) as(bar))";
+ " each(output(count())) as(bar))";
List<Grouping> result = Arrays.asList(newGrouping(newGroup(2, 1, new CountAggregationResult(1)),
- newGroup(2, 2, new CountAggregationResult(2)),
- newGroup(2, 3, new CountAggregationResult(3)),
- newGroup(2, 4, new CountAggregationResult(4))),
- newGrouping(newGroup(4, 1, new CountAggregationResult(1)),
- newGroup(4, 2, new CountAggregationResult(2)),
- newGroup(4, 3, new CountAggregationResult(3)),
- newGroup(4, 4, new CountAggregationResult(4))));
+ newGroup(2, 2, new CountAggregationResult(2)),
+ newGroup(2, 3, new CountAggregationResult(3)),
+ newGroup(2, 4, new CountAggregationResult(4))),
+ newGrouping(newGroup(4, 1, new CountAggregationResult(1)),
+ newGroup(4, 2, new CountAggregationResult(2)),
+ newGroup(4, 3, new CountAggregationResult(3)),
+ newGroup(4, 4, new CountAggregationResult(4))));
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 0),
- newOffset(newResultId(1), 4, 5)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {next=2}, [{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }, " +
- "{ 'grouplist:bar', {prev=2}, [] }] }");
+ newOffset(newResultId(1), 4, 5)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {next=2}, [{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }, " +
+ "{ 'grouplist:bar', {prev=2}, [] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 1),
- newOffset(newResultId(1), 4, 4)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {next=3, prev=0}, [{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }, " +
- "{ 'grouplist:bar', {prev=2}, [] }] }");
+ newOffset(newResultId(1), 4, 4)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {next=3, prev=0}, [{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }, " +
+ "{ 'grouplist:bar', {prev=2}, [] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 2),
- newOffset(newResultId(1), 4, 3)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {prev=0}, [{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }, " +
- "{ 'grouplist:bar', {prev=1}, [{ 'group:4', {}, [] }] }] }");
+ newOffset(newResultId(1), 4, 3)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {prev=0}, [{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }, " +
+ "{ 'grouplist:bar', {prev=1}, [{ 'group:4', {}, [] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 3),
- newOffset(newResultId(1), 4, 2)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {prev=1}, [{ 'group:4', {}, [] }] }, " +
- "{ 'grouplist:bar', {prev=0}, [{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
+ newOffset(newResultId(1), 4, 2)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {prev=1}, [{ 'group:4', {}, [] }] }, " +
+ "{ 'grouplist:bar', {prev=0}, [{ 'group:3', {}, [] }, { 'group:4', {}, [] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 4),
- newOffset(newResultId(1), 4, 1)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {prev=2}, [] }, " +
- "{ 'grouplist:bar', {next=3, prev=0}, [{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }] }");
+ newOffset(newResultId(1), 4, 1)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {prev=2}, [] }, " +
+ "{ 'grouplist:bar', {next=3, prev=0}, [{ 'group:2', {}, [] }, { 'group:3', {}, [] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0), 2, 5),
- newOffset(newResultId(1), 4, 0)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {prev=2}, [] }, " +
- "{ 'grouplist:bar', {next=2}, [{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }] }");
+ newOffset(newResultId(1), 4, 0)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {prev=2}, [] }, " +
+ "{ 'grouplist:bar', {next=2}, [{ 'group:1', {}, [] }, { 'group:2', {}, [] }] }] }");
}
@Test
- public void requireThatUnstableContinuationsDoNotAffectSiblingGroupLists() {
+ void requireThatUnstableContinuationsDoNotAffectSiblingGroupLists() {
String request = "all(group(a) each(group(b) max(2) each(group(c) max(2) each(output(count())))))";
Grouping result = newGrouping(newGroup(2, 201,
- newGroup(3, 301,
- newGroup(4, 401, new CountAggregationResult(1)),
- newGroup(4, 402, new CountAggregationResult(1)),
- newGroup(4, 403, new CountAggregationResult(1)),
- newGroup(4, 404, new CountAggregationResult(1))),
- newGroup(3, 302,
- newGroup(4, 405, new CountAggregationResult(1)),
- newGroup(4, 406, new CountAggregationResult(1)),
- newGroup(4, 407, new CountAggregationResult(1)),
- newGroup(4, 408, new CountAggregationResult(1))),
- newGroup(3, 303,
- newGroup(4, 409, new CountAggregationResult(1)),
- newGroup(4, 410, new CountAggregationResult(1)),
- newGroup(4, 411, new CountAggregationResult(1)),
- newGroup(4, 412, new CountAggregationResult(1))),
- newGroup(3, 304,
- newGroup(4, 413, new CountAggregationResult(1)),
- newGroup(4, 414, new CountAggregationResult(1)),
- newGroup(4, 415, new CountAggregationResult(1)),
- newGroup(4, 416, new CountAggregationResult(1)))),
- newGroup(2, 202,
- newGroup(3, 305,
- newGroup(4, 417, new CountAggregationResult(1)),
- newGroup(4, 418, new CountAggregationResult(1)),
- newGroup(4, 419, new CountAggregationResult(1)),
- newGroup(4, 420, new CountAggregationResult(1))),
- newGroup(3, 306,
- newGroup(4, 421, new CountAggregationResult(1)),
- newGroup(4, 422, new CountAggregationResult(1)),
- newGroup(4, 423, new CountAggregationResult(1)),
- newGroup(4, 424, new CountAggregationResult(1))),
- newGroup(3, 307,
- newGroup(4, 425, new CountAggregationResult(1)),
- newGroup(4, 426, new CountAggregationResult(1)),
- newGroup(4, 427, new CountAggregationResult(1)),
- newGroup(4, 428, new CountAggregationResult(1))),
- newGroup(3, 308,
- newGroup(4, 429, new CountAggregationResult(1)),
- newGroup(4, 430, new CountAggregationResult(1)),
- newGroup(4, 431, new CountAggregationResult(1)),
- newGroup(4, 432, new CountAggregationResult(1)))));
+ newGroup(3, 301,
+ newGroup(4, 401, new CountAggregationResult(1)),
+ newGroup(4, 402, new CountAggregationResult(1)),
+ newGroup(4, 403, new CountAggregationResult(1)),
+ newGroup(4, 404, new CountAggregationResult(1))),
+ newGroup(3, 302,
+ newGroup(4, 405, new CountAggregationResult(1)),
+ newGroup(4, 406, new CountAggregationResult(1)),
+ newGroup(4, 407, new CountAggregationResult(1)),
+ newGroup(4, 408, new CountAggregationResult(1))),
+ newGroup(3, 303,
+ newGroup(4, 409, new CountAggregationResult(1)),
+ newGroup(4, 410, new CountAggregationResult(1)),
+ newGroup(4, 411, new CountAggregationResult(1)),
+ newGroup(4, 412, new CountAggregationResult(1))),
+ newGroup(3, 304,
+ newGroup(4, 413, new CountAggregationResult(1)),
+ newGroup(4, 414, new CountAggregationResult(1)),
+ newGroup(4, 415, new CountAggregationResult(1)),
+ newGroup(4, 416, new CountAggregationResult(1)))),
+ newGroup(2, 202,
+ newGroup(3, 305,
+ newGroup(4, 417, new CountAggregationResult(1)),
+ newGroup(4, 418, new CountAggregationResult(1)),
+ newGroup(4, 419, new CountAggregationResult(1)),
+ newGroup(4, 420, new CountAggregationResult(1))),
+ newGroup(3, 306,
+ newGroup(4, 421, new CountAggregationResult(1)),
+ newGroup(4, 422, new CountAggregationResult(1)),
+ newGroup(4, 423, new CountAggregationResult(1)),
+ newGroup(4, 424, new CountAggregationResult(1))),
+ newGroup(3, 307,
+ newGroup(4, 425, new CountAggregationResult(1)),
+ newGroup(4, 426, new CountAggregationResult(1)),
+ newGroup(4, 427, new CountAggregationResult(1)),
+ newGroup(4, 428, new CountAggregationResult(1))),
+ newGroup(3, 308,
+ newGroup(4, 429, new CountAggregationResult(1)),
+ newGroup(4, 430, new CountAggregationResult(1)),
+ newGroup(4, 431, new CountAggregationResult(1)),
+ newGroup(4, 432, new CountAggregationResult(1)))));
assertContinuation(request, result, newComposite(),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:301', {}, [{ 'grouplist:c', {next=2}, [{ 'group:401', {}, [] }, { 'group:402', {}, [] }] }] }, " +
- "{ 'group:302', {}, [{ 'grouplist:c', {next=2}, [{ 'group:405', {}, [] }, { 'group:406', {}, [] }] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
- "{ 'group:306', {}, [{ 'grouplist:c', {next=2}, [{ 'group:421', {}, [] }, { 'group:422', {}, [] }] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:301', {}, [{ 'grouplist:c', {next=2}, [{ 'group:401', {}, [] }, { 'group:402', {}, [] }] }] }, " +
+ "{ 'group:302', {}, [{ 'grouplist:c', {next=2}, [{ 'group:405', {}, [] }, { 'group:406', {}, [] }] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
+ "{ 'group:306', {}, [{ 'grouplist:c', {next=2}, [{ 'group:421', {}, [] }, { 'group:422', {}, [] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:301', {}, [{ 'grouplist:c', {next=2}, [{ 'group:401', {}, [] }, { 'group:402', {}, [] }] }] }, " +
- "{ 'group:302', {}, [{ 'grouplist:c', {next=2}, [{ 'group:405', {}, [] }, { 'group:406', {}, [] }] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
- "{ 'group:306', {}, [{ 'grouplist:c', {prev=0}, [{ 'group:423', {}, [] }, { 'group:424', {}, [] }] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:301', {}, [{ 'grouplist:c', {next=2}, [{ 'group:401', {}, [] }, { 'group:402', {}, [] }] }] }, " +
+ "{ 'group:302', {}, [{ 'grouplist:c', {next=2}, [{ 'group:405', {}, [] }, { 'group:406', {}, [] }] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
+ "{ 'group:306', {}, [{ 'grouplist:c', {prev=0}, [{ 'group:423', {}, [] }, { 'group:424', {}, [] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2),
- newOffset(newResultId(0, 0, 0), 2, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
- "{ 'group:303', {}, [{ 'grouplist:c', {next=2}, [{ 'group:409', {}, [] }, { 'group:410', {}, [] }] }] }, " +
- "{ 'group:304', {}, [{ 'grouplist:c', {next=2}, [{ 'group:413', {}, [] }, { 'group:414', {}, [] }] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
- "{ 'group:306', {}, [{ 'grouplist:c', {prev=0}, [{ 'group:423', {}, [] }, { 'group:424', {}, [] }] }] }] }] }] }] }");
+ newOffset(newResultId(0, 0, 0), 2, 2)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
+ "{ 'group:303', {}, [{ 'grouplist:c', {next=2}, [{ 'group:409', {}, [] }, { 'group:410', {}, [] }] }] }, " +
+ "{ 'group:304', {}, [{ 'grouplist:c', {next=2}, [{ 'group:413', {}, [] }, { 'group:414', {}, [] }] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'grouplist:c', {next=2}, [{ 'group:417', {}, [] }, { 'group:418', {}, [] }] }] }, " +
+ "{ 'group:306', {}, [{ 'grouplist:c', {prev=0}, [{ 'group:423', {}, [] }, { 'group:424', {}, [] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2),
- newOffset(newResultId(0, 0, 0), 2, 2),
- newUnstableOffset(newResultId(0, 1, 0), 2, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
- "{ 'group:303', {}, [{ 'grouplist:c', {next=2}, [{ 'group:409', {}, [] }, { 'group:410', {}, [] }] }] }, " +
- "{ 'group:304', {}, [{ 'grouplist:c', {next=2}, [{ 'group:413', {}, [] }, { 'group:414', {}, [] }] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [" +
- "{ 'group:306', {}, [{ 'grouplist:c', {next=2}, [{ 'group:421', {}, [] }, { 'group:422', {}, [] }] }] }, " +
- "{ 'group:307', {}, [{ 'grouplist:c', {next=2}, [{ 'group:425', {}, [] }, { 'group:426', {}, [] }] }] }] }] }] }] }");
+ newOffset(newResultId(0, 0, 0), 2, 2),
+ newUnstableOffset(newResultId(0, 1, 0), 2, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
+ "{ 'group:303', {}, [{ 'grouplist:c', {next=2}, [{ 'group:409', {}, [] }, { 'group:410', {}, [] }] }] }, " +
+ "{ 'group:304', {}, [{ 'grouplist:c', {next=2}, [{ 'group:413', {}, [] }, { 'group:414', {}, [] }] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [" +
+ "{ 'group:306', {}, [{ 'grouplist:c', {next=2}, [{ 'group:421', {}, [] }, { 'group:422', {}, [] }] }] }, " +
+ "{ 'group:307', {}, [{ 'grouplist:c', {next=2}, [{ 'group:425', {}, [] }, { 'group:426', {}, [] }] }] }] }] }] }] }");
}
@Test
- public void requireThatUnstableContinuationsAffectAllDecendants() {
+ void requireThatUnstableContinuationsAffectAllDecendants() {
String request = "all(group(a) each(group(b) max(1) each(group(c) max(1) each(group(d) max(1) each(output(count()))))))";
Grouping result = newGrouping(newGroup(2, 201,
- newGroup(3, 301,
- newGroup(4, 401,
- newGroup(5, 501, new CountAggregationResult(1)),
- newGroup(5, 502, new CountAggregationResult(1))),
- newGroup(4, 402,
- newGroup(5, 503, new CountAggregationResult(1)),
- newGroup(5, 504, new CountAggregationResult(1)))),
- newGroup(3, 302,
- newGroup(4, 403,
- newGroup(5, 505, new CountAggregationResult(1)),
- newGroup(5, 506, new CountAggregationResult(1))),
- newGroup(4, 404,
- newGroup(5, 507, new CountAggregationResult(1)),
- newGroup(5, 508, new CountAggregationResult(1))))));
+ newGroup(3, 301,
+ newGroup(4, 401,
+ newGroup(5, 501, new CountAggregationResult(1)),
+ newGroup(5, 502, new CountAggregationResult(1))),
+ newGroup(4, 402,
+ newGroup(5, 503, new CountAggregationResult(1)),
+ newGroup(5, 504, new CountAggregationResult(1)))),
+ newGroup(3, 302,
+ newGroup(4, 403,
+ newGroup(5, 505, new CountAggregationResult(1)),
+ newGroup(5, 506, new CountAggregationResult(1))),
+ newGroup(4, 404,
+ newGroup(5, 507, new CountAggregationResult(1)),
+ newGroup(5, 508, new CountAggregationResult(1))))));
assertContinuation(request, result, newComposite(),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
- "{ 'group:301', {}, [{ 'grouplist:c', {next=1}, [" +
- "{ 'group:401', {}, [{ 'grouplist:d', {next=1}, [" +
- "{ 'group:501', {}, [] }] }] }] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
+ "{ 'group:301', {}, [{ 'grouplist:c', {next=1}, [" +
+ "{ 'group:401', {}, [{ 'grouplist:d', {next=1}, [" +
+ "{ 'group:501', {}, [] }] }] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0, 0, 0, 0, 0), 5, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
- "{ 'group:301', {}, [{ 'grouplist:c', {next=1}, [" +
- "{ 'group:401', {}, [{ 'grouplist:d', {prev=0}, [" +
- "{ 'group:502', {}, [] }] }] }] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
+ "{ 'group:301', {}, [{ 'grouplist:c', {next=1}, [" +
+ "{ 'group:401', {}, [{ 'grouplist:d', {prev=0}, [" +
+ "{ 'group:502', {}, [] }] }] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0, 0, 0, 0, 0), 5, 1),
- newUnstableOffset(newResultId(0, 0, 0, 0, 0), 4, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
- "{ 'group:301', {}, [{ 'grouplist:c', {prev=0}, [" +
- "{ 'group:402', {}, [{ 'grouplist:d', {next=1}, [" +
- "{ 'group:503', {}, [] }] }] }] }] }] }] }] }] }");
+ newUnstableOffset(newResultId(0, 0, 0, 0, 0), 4, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=1}, [" +
+ "{ 'group:301', {}, [{ 'grouplist:c', {prev=0}, [" +
+ "{ 'group:402', {}, [{ 'grouplist:d', {next=1}, [" +
+ "{ 'group:503', {}, [] }] }] }] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0, 0, 0, 0, 0), 5, 1),
- newUnstableOffset(newResultId(0, 0, 0, 0, 0), 4, 1),
- newUnstableOffset(newResultId(0, 0, 0), 3, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
- "{ 'group:302', {}, [{ 'grouplist:c', {next=1}, [" +
- "{ 'group:403', {}, [{ 'grouplist:d', {next=1}, [" +
- "{ 'group:505', {}, [] }] }] }] }] }] }] }] }] }");
+ newUnstableOffset(newResultId(0, 0, 0, 0, 0), 4, 1),
+ newUnstableOffset(newResultId(0, 0, 0), 3, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
+ "{ 'group:302', {}, [{ 'grouplist:c', {next=1}, [" +
+ "{ 'group:403', {}, [{ 'grouplist:d', {next=1}, [" +
+ "{ 'group:505', {}, [] }] }] }] }] }] }] }] }] }");
}
@Test
- public void requireThatHitListContinuationsAreNotCreatedUnlessMaxIsSet() {
+ void requireThatHitListContinuationsAreNotCreatedUnlessMaxIsSet() {
assertContinuation("all(group(a) each(each(output(summary()))))",
- newGrouping(newGroup(2, newHitList(3, 4))),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {}, [hit:1, hit:2, hit:3, hit:4] }] }] }] }");
+ newGrouping(newGroup(2, newHitList(3, 4))),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {}, [hit:1, hit:2, hit:3, hit:4] }] }] }] }");
}
@Test
- public void requireThatHitListContinuationsCanBeSet() {
+ void requireThatHitListContinuationsCanBeSet() {
String request = "all(group(a) each(max(2) each(output(summary()))))";
Grouping result = newGrouping(newGroup(2, newHitList(3, 4)));
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 0),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 1),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 2),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 3),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 4),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newOffset(newResultId(0, 0, 0), 3, 5),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
}
@Test
- public void requireThatHitListContinuationsCanBeSetInSiblingGroups() {
+ void requireThatHitListContinuationsCanBeSetInSiblingGroups() {
String request = "all(group(a) each(max(2) each(output(summary()))))";
Grouping result = newGrouping(newGroup(2, 201, newHitList(3, 4)),
- newGroup(2, 202, newHitList(3, 4)));
+ newGroup(2, 202, newHitList(3, 4)));
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 0),
- newOffset(newResultId(0, 1, 0), 3, 5)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 5)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 1),
- newOffset(newResultId(0, 1, 0), 3, 4)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 4)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 2),
- newOffset(newResultId(0, 1, 0), 3, 3)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 3)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 3),
- newOffset(newResultId(0, 1, 0), 3, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 2)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 4),
- newOffset(newResultId(0, 1, 0), 3, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {prev=2}, [] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {prev=2}, [] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 5),
- newOffset(newResultId(0, 1, 0), 3, 0)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'hitlist:hits', {prev=2}, [] }] }, " +
- "{ 'group:202', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
+ newOffset(newResultId(0, 1, 0), 3, 0)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'hitlist:hits', {prev=2}, [] }] }, " +
+ "{ 'group:202', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
}
@Test
- public void requireThatHitListContinuationsCanBeSetInSiblingHitLists() {
+ void requireThatHitListContinuationsCanBeSetInSiblingHitLists() {
String request = "all(group(a) each(max(2) each(output(summary()))) as(foo)" +
- " each(max(2) each(output(summary()))) as(bar))";
+ " each(max(2) each(output(summary()))) as(bar))";
List<Grouping> result = Arrays.asList(newGrouping(newGroup(2, newHitList(3, 4))),
- newGrouping(newGroup(4, newHitList(5, 4))));
+ newGrouping(newGroup(4, newHitList(5, 4))));
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 0),
- newOffset(newResultId(1, 0, 0), 5, 5)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 5)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 1),
- newOffset(newResultId(1, 0, 0), 5, 4)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 4)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 2),
- newOffset(newResultId(1, 0, 0), 5, 3)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 3)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 3),
- newOffset(newResultId(1, 0, 0), 5, 2)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 2)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=1}, [hit:4] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 4),
- newOffset(newResultId(1, 0, 0), 5, 1)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 1)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {next=3, prev=0}, [hit:2, hit:3] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 0, 0), 3, 5),
- newOffset(newResultId(1, 0, 0), 5, 0)),
- "{ 'group:root', {}, [" +
- "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }, " +
- "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
+ newOffset(newResultId(1, 0, 0), 5, 0)),
+ "{ 'group:root', {}, [" +
+ "{ 'grouplist:foo', {}, [{ 'group:2', {}, [{ 'hitlist:hits', {prev=2}, [] }] }] }, " +
+ "{ 'grouplist:bar', {}, [{ 'group:4', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }");
}
@Test
- public void requireThatUnstableContinuationsDoNotAffectSiblingHitLists() {
+ void requireThatUnstableContinuationsDoNotAffectSiblingHitLists() {
String request = "all(group(a) each(group(b) max(2) each(max(2) each(output(summary())))))";
Grouping result = newGrouping(newGroup(2, 201,
- newGroup(3, 301, newHitList(4, 4)),
- newGroup(3, 302, newHitList(4, 4)),
- newGroup(3, 303, newHitList(4, 4)),
- newGroup(3, 304, newHitList(4, 4))),
- newGroup(2, 202,
- newGroup(3, 305, newHitList(4, 4)),
- newGroup(3, 306, newHitList(4, 4)),
- newGroup(3, 307, newHitList(4, 4)),
- newGroup(3, 308, newHitList(4, 4))));
+ newGroup(3, 301, newHitList(4, 4)),
+ newGroup(3, 302, newHitList(4, 4)),
+ newGroup(3, 303, newHitList(4, 4)),
+ newGroup(3, 304, newHitList(4, 4))),
+ newGroup(2, 202,
+ newGroup(3, 305, newHitList(4, 4)),
+ newGroup(3, 306, newHitList(4, 4)),
+ newGroup(3, 307, newHitList(4, 4)),
+ newGroup(3, 308, newHitList(4, 4))));
assertContinuation(request, result, newComposite(),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:301', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:302', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:306', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:301', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:302', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:306', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:301', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:302', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:306', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }] }] }");
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:301', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:302', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:306', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2),
- newOffset(newResultId(0, 0, 0), 2, 2)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
- "{ 'group:303', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:304', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
- "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:306', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }] }] }");
+ newOffset(newResultId(0, 0, 0), 2, 2)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
+ "{ 'group:303', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:304', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=2}, [" +
+ "{ 'group:305', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:306', {}, [{ 'hitlist:hits', {prev=0}, [hit:3, hit:4] }] }] }] }] }] }");
assertContinuation(request, result, newComposite(newOffset(newResultId(0, 1, 0, 1, 0), 4, 2),
- newOffset(newResultId(0, 0, 0), 2, 2),
- newUnstableOffset(newResultId(0, 1, 0), 2, 1)),
- "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
- "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
- "{ 'group:303', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:304', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
- "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [" +
- "{ 'group:306', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
- "{ 'group:307', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }] }] }");
+ newOffset(newResultId(0, 0, 0), 2, 2),
+ newUnstableOffset(newResultId(0, 1, 0), 2, 1)),
+ "{ 'group:root', {}, [{ 'grouplist:a', {}, [" +
+ "{ 'group:201', {}, [{ 'grouplist:b', {prev=0}, [" +
+ "{ 'group:303', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:304', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }, " +
+ "{ 'group:202', {}, [{ 'grouplist:b', {next=3, prev=0}, [" +
+ "{ 'group:306', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }, " +
+ "{ 'group:307', {}, [{ 'hitlist:hits', {next=2}, [hit:1, hit:2] }] }] }] }] }] }");
}
// --------------------------------------------------------------------------------
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultIdTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultIdTestCase.java
index 8afaa4922ec..0e38e688258 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultIdTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/ResultIdTestCase.java
@@ -1,11 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.vespa;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -13,7 +11,7 @@ import static org.junit.Assert.assertTrue;
public class ResultIdTestCase {
@Test
- public void requireThatStartsWithWorks() {
+ void requireThatStartsWithWorks() {
assertFalse(ResultId.valueOf().startsWith(1, 1, 2, 3));
assertFalse(ResultId.valueOf(1).startsWith(1, 1, 2, 3));
assertFalse(ResultId.valueOf(1, 1).startsWith(1, 1, 2, 3));
@@ -26,32 +24,32 @@ public class ResultIdTestCase {
}
@Test
- public void requireThatChildIdStartsWithParentId() {
+ void requireThatChildIdStartsWithParentId() {
ResultId parentId = ResultId.valueOf(1, 1, 2);
ResultId childId = parentId.newChildId(3);
assertTrue(childId.startsWith(1, 1, 2));
}
@Test
- public void requireThatHashCodeIsImplemented() {
+ void requireThatHashCodeIsImplemented() {
assertEquals(ResultId.valueOf(1, 1, 2, 3).hashCode(), ResultId.valueOf(1, 1, 2, 3).hashCode());
- assertFalse(ResultId.valueOf(1, 1, 2, 3).hashCode() == ResultId.valueOf(5, 8, 13, 21).hashCode());
+ assertNotNull(ResultId.valueOf(5, 8, 13, 21).hashCode());
}
@Test
- public void requireThatEqualsIsImplemented() {
+ void requireThatEqualsIsImplemented() {
assertEquals(ResultId.valueOf(1, 1, 2, 3), ResultId.valueOf(1, 1, 2, 3));
- assertFalse(ResultId.valueOf(1, 1, 2, 3).equals(ResultId.valueOf(5, 8, 13, 21)));
+ assertNotEquals(ResultId.valueOf(1, 1, 2, 3), ResultId.valueOf(5, 8, 13, 21));
}
@Test
- public void requireThatResultIdCanBeEncoded() {
+ void requireThatResultIdCanBeEncoded() {
assertEncode("BIBCBCBEBG", ResultId.valueOf(1, 1, 2, 3));
assertEncode("BIBKCBACBKCCK", ResultId.valueOf(5, 8, 13, 21));
}
@Test
- public void requireThatResultIdCanBeDecoded() {
+ void requireThatResultIdCanBeDecoded() {
assertDecode(ResultId.valueOf(1, 1, 2, 3), "BIBCBCBEBG");
assertDecode(ResultId.valueOf(5, 8, 13, 21), "BIBKCBACBKCCK");
}