aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/AnnotationReferenceTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/ArraysTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/ArraysWeightedSetsTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/schema/AttributeSettingsTestCase.java65
-rw-r--r--config-model/src/test/java/com/yahoo/schema/CommentTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/DiversityTestCase.java13
-rw-r--r--config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java101
-rw-r--r--config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java86
-rw-r--r--config-model/src/test/java/com/yahoo/schema/FeatureNamesTestCase.java30
-rw-r--r--config-model/src/test/java/com/yahoo/schema/FieldOfTypeDocumentTestCase.java11
-rw-r--r--config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/IncorrectRankingExpressionFileRefTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/IncorrectSummaryTypesTestCase.java29
-rw-r--r--config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java24
-rw-r--r--config-model/src/test/java/com/yahoo/schema/IndexingParsingTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/MultipleSummariesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/NameFieldCheckTestCase.java68
-rw-r--r--config-model/src/test/java/com/yahoo/schema/OutsideTestCase.java15
-rw-r--r--config-model/src/test/java/com/yahoo/schema/PredicateDataTypeTestCase.java143
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankProfileRegistryTest.java26
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankProfileTestCase.java42
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankPropertiesTestCase.java19
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingConstantTest.java82
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionConstantsTestCase.java25
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java56
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java302
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionShadowingTestCase.java32
-rw-r--r--config-model/src/test/java/com/yahoo/schema/RankingExpressionValidationTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/schema/ReservedWordsAsFieldNamesTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java43
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SchemaParsingTestCase.java21
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java441
-rw-r--r--config-model/src/test/java/com/yahoo/schema/StemmingSettingTestCase.java10
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/StructTestCase.java24
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java93
-rw-r--r--config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java18
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/AnnotationsTestCase.java22
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ArraysTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java42
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/AttributesTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/CasingTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/CombinedAttributeAndIndexSchemaTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/DeriverTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/DuplicateStructTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/EmptyRankProfileTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ExactMatchTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ExportingTestCase.java82
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ExpressionsAsArgsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/FieldsetTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/GeminiTestCase.java7
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ImportedFieldsTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java138
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java47
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/IntegerAttributeToStringIndexTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java30
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/LowercaseTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/MailTestCase.java5
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/MatchSettingsResolvingTestCase.java22
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/MultiStructTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/MultipleSummariesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/NameCollisionTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/NativeRankTypeDefinitionsTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/NearestNeighborTestCase.java13
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/NeuralNetTestCase.java11
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/NuwaTestCase.java10
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/OrderIlscriptsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/PrefixExactAttributeTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/RankProfilesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/RankPropertiesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ReferenceFieldsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/ReferenceFromSeveralTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SchemaInheritanceTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java32
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SimpleInheritTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SliceTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SortingTestCase.java4
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/StreamingStructTestCase.java6
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/StructAnyOrderTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/StructInheritanceTestCase.java37
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SummaryMapTestCase.java32
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java17
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/schema/derived/TokenizationTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/TwoStreamingStructsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/TypesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/document/ComplexAttributeFieldUtilsTestCase.java22
-rw-r--r--config-model/src/test/java/com/yahoo/schema/document/HnswIndexParamsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/parser/ConvertIntermediateTestCase.java38
-rw-r--r--config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java75
-rw-r--r--config-model/src/test/java/com/yahoo/schema/parser/ParsedDocumentTestCase.java15
-rw-r--r--config-model/src/test/java/com/yahoo/schema/parser/SchemaParserTestCase.java55
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AdjustPositionSummaryFieldsTestCase.java134
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AssertIndexingScript.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AssertSearchBuilder.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AttributesExactMatchTestCase.java21
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/BoldingTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/BoolAttributeValidatorTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/DictionaryTestCase.java83
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java46
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java85
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java18
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummariesTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummaryFieldsTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsResolverTestCase.java76
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsTestCase.java119
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java28
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java90
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java48
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IntegerIndex2AttributeTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/MatchPhaseSettingsValidatorTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java39
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/NGramTestCase.java19
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java19
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java18
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankModifierTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankProfileSearchFixture.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankPropertyVariablesTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionTypeResolverTestCase.java174
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithLightGBMTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxTestCase.java75
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTensorTestCase.java184
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithXGBoostTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java27
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ReferenceFieldTestCase.java79
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ReservedDocumentNamesTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ReservedRankingExpressionFunctionNamesTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/SummaryFieldsMustHaveValidSourceTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java37
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/TensorTransformTestCase.java86
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java31
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/VespaMlModelTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/WeightedSetSummaryToTestCase.java6
142 files changed, 2303 insertions, 2356 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/AnnotationReferenceTestCase.java b/config-model/src/test/java/com/yahoo/schema/AnnotationReferenceTestCase.java
index dbe827ed67f..18ff1fd8536 100644
--- a/config-model/src/test/java/com/yahoo/schema/AnnotationReferenceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/AnnotationReferenceTestCase.java
@@ -7,11 +7,11 @@ import com.yahoo.document.Field;
import com.yahoo.document.annotation.AnnotationReferenceDataType;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.config.model.deploy.TestProperties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author arnej
@@ -38,9 +38,9 @@ public class AnnotationReferenceTestCase {
" }",
" }",
"}");
-
+
@Test
- public void noAnnotationReferenceInDocument() throws Exception {
+ void noAnnotationReferenceInDocument() throws Exception {
var builder = new ApplicationBuilder(new TestProperties());
builder.addSchema(sd);
builder.build(true);
@@ -49,7 +49,7 @@ public class AnnotationReferenceTestCase {
var complex = doc.findAnnotation("complex");
var dt = complex.getDataType();
assertTrue(dt instanceof StructDataType);
- var struct = (StructDataType)dt;
+ var struct = (StructDataType) dt;
var field = struct.getField("owner");
assertTrue(field.getDataType() instanceof AnnotationReferenceDataType);
}
diff --git a/config-model/src/test/java/com/yahoo/schema/ArraysTestCase.java b/config-model/src/test/java/com/yahoo/schema/ArraysTestCase.java
index aab79617556..a03bf3bf8de 100644
--- a/config-model/src/test/java/com/yahoo/schema/ArraysTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/ArraysTestCase.java
@@ -6,12 +6,12 @@ import com.yahoo.document.CollectionDataType;
import com.yahoo.document.DataType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
/**
* tests importing of document containing array type fields
@@ -21,15 +21,15 @@ import static org.junit.Assert.assertTrue;
public class ArraysTestCase extends AbstractSchemaTestCase {
@Test
- public void testArrayImporting() throws IOException, ParseException {
+ void testArrayImporting() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/arrays.sd");
SDField tags = (SDField) schema.getDocument().getField("tags");
- assertEquals(DataType.STRING, ((CollectionDataType)tags.getDataType()).getNestedType());
+ assertEquals(DataType.STRING, ((CollectionDataType) tags.getDataType()).getNestedType());
SDField ratings = (SDField) schema.getDocument().getField("ratings");
assertTrue(ratings.getDataType() instanceof ArrayDataType);
- assertEquals(DataType.INT, ((ArrayDataType)ratings.getDataType()).getNestedType());
+ assertEquals(DataType.INT, ((ArrayDataType) ratings.getDataType()).getNestedType());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/ArraysWeightedSetsTestCase.java b/config-model/src/test/java/com/yahoo/schema/ArraysWeightedSetsTestCase.java
index 57331bea6bd..7d72cce1401 100644
--- a/config-model/src/test/java/com/yahoo/schema/ArraysWeightedSetsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/ArraysWeightedSetsTestCase.java
@@ -6,10 +6,10 @@ import com.yahoo.document.CollectionDataType;
import com.yahoo.document.DataType;
import com.yahoo.document.WeightedSetDataType;
import com.yahoo.schema.document.SDField;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* tests importing of document containing array type fields and weighted set type fields, new syntax.
@@ -18,24 +18,24 @@ import static org.junit.Assert.assertTrue;
*/
public class ArraysWeightedSetsTestCase extends AbstractSchemaTestCase {
@Test
- public void testArrayWeightedSetsImporting() throws java.io.IOException, com.yahoo.schema.parser.ParseException {
+ void testArrayWeightedSetsImporting() throws java.io.IOException, com.yahoo.schema.parser.ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/arraysweightedsets.sd");
SDField tags = (SDField) schema.getDocument().getField("tags");
assertTrue(tags.getDataType() instanceof ArrayDataType);
- assertEquals(DataType.STRING, ((CollectionDataType)tags.getDataType()).getNestedType());
+ assertEquals(DataType.STRING, ((CollectionDataType) tags.getDataType()).getNestedType());
SDField ratings = (SDField) schema.getDocument().getField("ratings");
assertTrue(ratings.getDataType() instanceof ArrayDataType);
- assertEquals(DataType.INT, ((CollectionDataType)ratings.getDataType()).getNestedType());
+ assertEquals(DataType.INT, ((CollectionDataType) ratings.getDataType()).getNestedType());
SDField flags = (SDField) schema.getDocument().getField("flags");
assertTrue(flags.getDataType() instanceof WeightedSetDataType);
- assertEquals(DataType.STRING, ((CollectionDataType)flags.getDataType()).getNestedType());
+ assertEquals(DataType.STRING, ((CollectionDataType) flags.getDataType()).getNestedType());
SDField banners = (SDField) schema.getDocument().getField("banners");
assertTrue(banners.getDataType() instanceof WeightedSetDataType);
- assertEquals(DataType.INT, ((CollectionDataType)banners.getDataType()).getNestedType());
+ assertEquals(DataType.INT, ((CollectionDataType) banners.getDataType()).getNestedType());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/AttributeSettingsTestCase.java b/config-model/src/test/java/com/yahoo/schema/AttributeSettingsTestCase.java
index 885cc385dfa..54fb6b0fb52 100644
--- a/config-model/src/test/java/com/yahoo/schema/AttributeSettingsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/AttributeSettingsTestCase.java
@@ -10,16 +10,12 @@ import com.yahoo.schema.parser.ParseException;
import com.yahoo.tensor.TensorType;
import com.yahoo.vespa.config.search.AttributesConfig;
import com.yahoo.vespa.configdefinition.IlscriptsConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Optional;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Attribute settings
@@ -29,10 +25,10 @@ import static org.junit.Assert.fail;
public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
@Test
- public void testAttributeSettings() throws IOException, ParseException {
+ void testAttributeSettings() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/attributesettings.sd");
- SDField f1=(SDField) schema.getDocument().getField("f1");
+ SDField f1 = (SDField) schema.getDocument().getField("f1");
assertEquals(1, f1.getAttributes().size());
Attribute a1 = f1.getAttributes().get(f1.getName());
assertEquals(Attribute.Type.LONG, a1.getType());
@@ -42,7 +38,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
assertFalse(a1.isRemoveIfZero());
assertFalse(a1.isCreateIfNonExistent());
- SDField f2=(SDField) schema.getDocument().getField("f2");
+ SDField f2 = (SDField) schema.getDocument().getField("f2");
assertEquals(1, f2.getAttributes().size());
Attribute a2 = f2.getAttributes().get(f2.getName());
assertEquals(Attribute.Type.LONG, a2.getType());
@@ -52,7 +48,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
assertFalse(a2.isRemoveIfZero());
assertFalse(a2.isCreateIfNonExistent());
assertEquals("f2", f2.getAliasToName().get("f2alias"));
- SDField f3=(SDField) schema.getDocument().getField("f3");
+ SDField f3 = (SDField) schema.getDocument().getField("f3");
assertEquals(1, f3.getAttributes().size());
assertEquals("f3", f3.getAliasToName().get("f3alias"));
@@ -103,7 +99,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatFastAccessCanBeSet() throws IOException, ParseException {
+ void requireThatFastAccessCanBeSet() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/attributesettings.sd");
SDField field = (SDField) schema.getDocument().getField("fast_access");
assertEquals(1, field.getAttributes().size());
@@ -125,7 +121,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatPagedIsDefaultOff() throws ParseException {
+ void requireThatPagedIsDefaultOff() throws ParseException {
Attribute attr = getAttributeF(
"search test {\n" +
" document test { \n" +
@@ -136,8 +132,9 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
"}\n");
assertFalse(attr.isPaged());
}
+
@Test
- public void requireThatPagedCanBeSet() throws ParseException {
+ void requireThatPagedCanBeSet() throws ParseException {
Attribute attr = getAttributeF(
"search test {\n" +
" document test { \n" +
@@ -151,29 +148,29 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatMutableIsDefaultOff() throws ParseException {
+ void requireThatMutableIsDefaultOff() throws ParseException {
Attribute attr = getAttributeF(
"search test {\n" +
- " document test { \n" +
- " field f type int { \n" +
- " indexing: attribute \n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " field f type int { \n" +
+ " indexing: attribute \n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
assertFalse(attr.isMutable());
}
@Test
- public void requireThatMutableCanNotbeSetInDocument() throws ParseException {
+ void requireThatMutableCanNotbeSetInDocument() throws ParseException {
try {
getSchema("search test {\n" +
- " document test {\n" +
- " field f type int {\n" +
- " indexing: attribute\n" +
- " attribute: mutable\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test {\n" +
+ " field f type int {\n" +
+ " indexing: attribute\n" +
+ " attribute: mutable\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
fail();
} catch (IllegalArgumentException e) {
assertEquals("Field 'f' in 'test' can not be marked mutable as it is inside the document clause.", e.getMessage());
@@ -181,7 +178,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatMutableExtraFieldCanBeSet() throws ParseException {
+ void requireThatMutableExtraFieldCanBeSet() throws ParseException {
Attribute attr = getAttributeF(
"search test {\n" +
" document test { \n" +
@@ -216,7 +213,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatMutableConfigIsProperlyPropagated() throws ParseException {
+ void requireThatMutableConfigIsProperlyPropagated() throws ParseException {
AttributeFields attributes = new AttributeFields(getSearchWithMutables());
AttributesConfig.Builder builder = new AttributesConfig.Builder();
attributes.getConfig(builder, AttributeFields.FieldSet.ALL, 13333, true);
@@ -232,7 +229,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireMaxUnCommittedMemoryIsProperlyPropagated() throws ParseException {
+ void requireMaxUnCommittedMemoryIsProperlyPropagated() throws ParseException {
AttributeFields attributes = new AttributeFields(getSearchWithMutables());
AttributesConfig.Builder builder = new AttributesConfig.Builder();
attributes.getConfig(builder, AttributeFields.FieldSet.ALL, 13333, true);
@@ -260,7 +257,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireEnableBitVectorsIsProperlyPropagated() throws ParseException {
+ void requireEnableBitVectorsIsProperlyPropagated() throws ParseException {
Schema schema = getSchema(
"search test {\n" +
" document test { \n" +
@@ -278,7 +275,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatMutableIsAllowedThroughIndexing() throws ParseException {
+ void requireThatMutableIsAllowedThroughIndexing() throws ParseException {
IndexingScript script = new IndexingScript(getSearchWithMutables());
IlscriptsConfig.Builder builder = new IlscriptsConfig.Builder();
script.getConfig(builder);
@@ -293,7 +290,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void attribute_convert_to_array_copies_internal_state() {
+ void attribute_convert_to_array_copies_internal_state() {
StructDataType refType = new StructDataType("my_struct");
Attribute single = new Attribute("foo", Attribute.Type.STRING, Attribute.CollectionType.SINGLE,
Optional.of(TensorType.fromSpec("tensor(x{})")), Optional.of(refType));
diff --git a/config-model/src/test/java/com/yahoo/schema/CommentTestCase.java b/config-model/src/test/java/com/yahoo/schema/CommentTestCase.java
index 4df4ead171b..ca726d8cd57 100644
--- a/config-model/src/test/java/com/yahoo/schema/CommentTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/CommentTestCase.java
@@ -3,11 +3,11 @@ package com.yahoo.schema;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests comment handling
@@ -17,11 +17,11 @@ import static org.junit.Assert.assertEquals;
public class CommentTestCase extends AbstractSchemaTestCase {
@Test
- public void testComments() throws IOException, ParseException {
+ void testComments() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/comment.sd");
SDField field = schema.getConcreteField("a");
assertEquals("{ input a | tokenize normalize stem:\"BEST\" | summary a | index a; }",
- field.getIndexingScript().toString());
+ field.getIndexingScript().toString());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/DiversityTestCase.java b/config-model/src/test/java/com/yahoo/schema/DiversityTestCase.java
index 482bc877081..06b38224c37 100644
--- a/config-model/src/test/java/com/yahoo/schema/DiversityTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/DiversityTestCase.java
@@ -3,17 +3,17 @@ package com.yahoo.schema;
import com.yahoo.search.query.ranking.Diversity;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author baldersheim
*/
public class DiversityTestCase {
@Test
- public void testDiversity() throws ParseException {
+ void testDiversity() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -58,8 +58,9 @@ public class DiversityTestCase {
private static String getMessagePrefix() {
return "In search definition 'test', rank-profile 'parent': diversity attribute 'b' ";
}
+
@Test
- public void requireSingleNumericOrString() throws ParseException {
+ void requireSingleNumericOrString() throws ParseException {
ApplicationBuilder builder = getSearchBuilder("field b type predicate { indexing: attribute }");
try {
@@ -71,7 +72,7 @@ public class DiversityTestCase {
}
@Test
- public void requireSingle() throws ParseException {
+ void requireSingle() throws ParseException {
ApplicationBuilder builder = getSearchBuilder("field b type array<int> { indexing: attribute }");
try {
diff --git a/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java b/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
index ef4d8e05540..ccfa5c51a16 100644
--- a/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
@@ -6,9 +6,7 @@ import com.yahoo.documentmodel.NewDocumentReferenceDataType;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporarySDField;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
@@ -17,20 +15,15 @@ import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.toList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author bjorncs
*/
public class DocumentGraphValidatorTest {
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void simple_ref_dag_is_allowed() {
+ void simple_ref_dag_is_allowed() {
Schema advertiserSchema = createSearchWithName("advertiser");
Schema campaignSchema = createSearchWithName("campaign");
Schema adSchema = createSearchWithName("ad");
@@ -42,7 +35,7 @@ public class DocumentGraphValidatorTest {
}
@Test
- public void simple_inheritance_dag_is_allowed() {
+ void simple_inheritance_dag_is_allowed() {
Schema grandfather = createSearchWithName("grandfather");
Schema father = createSearchWithName("father", grandfather);
Schema son = createSearchWithName("son", father);
@@ -52,7 +45,7 @@ public class DocumentGraphValidatorTest {
}
@Test
- public void complex_dag_is_allowed() {
+ void complex_dag_is_allowed() {
Schema grandfather = createSearchWithName("grandfather");
Schema father = createSearchWithName("father", grandfather);
Schema mother = createSearchWithName("mother", grandfather);
@@ -70,55 +63,59 @@ public class DocumentGraphValidatorTest {
}
@Test
- public void ref_cycle_is_forbidden() {
- Schema schema1 = createSearchWithName("doc1");
- Schema schema2 = createSearchWithName("doc2");
- Schema schema3 = createSearchWithName("doc3");
- createDocumentReference(schema1, schema2, "ref_2");
- createDocumentReference(schema2, schema3, "ref_3");
- createDocumentReference(schema3, schema1, "ref_1");
-
- DocumentGraphValidator validator = new DocumentGraphValidator();
- exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class);
- exceptionRule.expectMessage("Document dependency cycle detected: doc1->doc2->doc3->doc1.");
- validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ void ref_cycle_is_forbidden() {
+ Throwable exception = assertThrows(DocumentGraphValidator.DocumentGraphException.class, () -> {
+ Schema schema1 = createSearchWithName("doc1");
+ Schema schema2 = createSearchWithName("doc2");
+ Schema schema3 = createSearchWithName("doc3");
+ createDocumentReference(schema1, schema2, "ref_2");
+ createDocumentReference(schema2, schema3, "ref_3");
+ createDocumentReference(schema3, schema1, "ref_1");
+
+ DocumentGraphValidator validator = new DocumentGraphValidator();
+ validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ });
+ assertTrue(exception.getMessage().contains("Document dependency cycle detected: doc1->doc2->doc3->doc1."));
}
@Test
- public void inherit_cycle_is_forbidden() {
- Schema schema1 = createSearchWithName("doc1");
- Schema schema2 = createSearchWithName("doc2", schema1);
- Schema schema3 = createSearchWithName("doc3", schema2);
- schema1.getDocument().inherit(schema3.getDocument());
-
- DocumentGraphValidator validator = new DocumentGraphValidator();
- exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class);
- exceptionRule.expectMessage("Document dependency cycle detected: doc1->doc3->doc2->doc1.");
- validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ void inherit_cycle_is_forbidden() {
+ Throwable exception = assertThrows(DocumentGraphValidator.DocumentGraphException.class, () -> {
+ Schema schema1 = createSearchWithName("doc1");
+ Schema schema2 = createSearchWithName("doc2", schema1);
+ Schema schema3 = createSearchWithName("doc3", schema2);
+ schema1.getDocument().inherit(schema3.getDocument());
+
+ DocumentGraphValidator validator = new DocumentGraphValidator();
+ validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ });
+ assertTrue(exception.getMessage().contains("Document dependency cycle detected: doc1->doc3->doc2->doc1."));
}
@Test
- public void combined_inherit_and_ref_cycle_is_forbidden() {
- Schema schema1 = createSearchWithName("doc1");
- Schema schema2 = createSearchWithName("doc2", schema1);
- Schema schema3 = createSearchWithName("doc3", schema2);
- createDocumentReference(schema1, schema3, "ref_1");
-
- DocumentGraphValidator validator = new DocumentGraphValidator();
- exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class);
- exceptionRule.expectMessage("Document dependency cycle detected: doc1->doc3->doc2->doc1.");
- validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ void combined_inherit_and_ref_cycle_is_forbidden() {
+ Throwable exception = assertThrows(DocumentGraphValidator.DocumentGraphException.class, () -> {
+ Schema schema1 = createSearchWithName("doc1");
+ Schema schema2 = createSearchWithName("doc2", schema1);
+ Schema schema3 = createSearchWithName("doc3", schema2);
+ createDocumentReference(schema1, schema3, "ref_1");
+
+ DocumentGraphValidator validator = new DocumentGraphValidator();
+ validator.validateDocumentGraph(documentListOf(schema1, schema2, schema3));
+ });
+ assertTrue(exception.getMessage().contains("Document dependency cycle detected: doc1->doc3->doc2->doc1."));
}
@Test
- public void self_reference_is_forbidden() {
- Schema adSchema = createSearchWithName("ad");
- createDocumentReference(adSchema, adSchema, "ad_ref");
+ void self_reference_is_forbidden() {
+ Throwable exception = assertThrows(DocumentGraphValidator.DocumentGraphException.class, () -> {
+ Schema adSchema = createSearchWithName("ad");
+ createDocumentReference(adSchema, adSchema, "ad_ref");
- DocumentGraphValidator validator = new DocumentGraphValidator();
- exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class);
- exceptionRule.expectMessage("Document dependency cycle detected: ad->ad.");
- validator.validateDocumentGraph(documentListOf(adSchema));
+ DocumentGraphValidator validator = new DocumentGraphValidator();
+ validator.validateDocumentGraph(documentListOf(adSchema));
+ });
+ assertTrue(exception.getMessage().contains("Document dependency cycle detected: ad->ad."));
}
/**
@@ -126,7 +123,7 @@ public class DocumentGraphValidatorTest {
* produces a stack overflow before getting to graph validation.
*/
@Test
- public void self_inheritance_forbidden() {
+ void self_inheritance_forbidden() {
try {
Schema adSchema = createSearchWithName("ad");
SDDocumentType document = adSchema.getDocument();
diff --git a/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java b/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
index 1592060f466..bcf8c6045b3 100644
--- a/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
@@ -6,17 +6,13 @@ import com.yahoo.document.DataType;
import com.yahoo.documentmodel.NewDocumentReferenceDataType;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.util.Map;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
-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 bjorncs
@@ -25,12 +21,9 @@ public class DocumentReferenceResolverTest {
private static final String BAR = "bar";
private static final String FOO = "foo";
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
@Test
- public void reference_from_one_document_to_another_is_resolved() {
+ void reference_from_one_document_to_another_is_resolved() {
// Create bar document with no fields
Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty());
SDDocumentType barDocument = new SDDocumentType(BAR, barSchema);
@@ -40,7 +33,7 @@ public class DocumentReferenceResolverTest {
Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
SDField fooRefToBarField = new SDField
- (fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
+ (fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
AttributeUtils.addAttributeAspect(fooRefToBarField);
SDField irrelevantField = new SDField(fooDocument, "irrelevant_stuff", DataType.INT);
fooDocument.addField(fooRefToBarField);
@@ -59,45 +52,44 @@ public class DocumentReferenceResolverTest {
@SuppressWarnings("deprecation")
@Test
- public void throws_user_friendly_exception_if_referenced_document_does_not_exist() {
- // Create foo document with document reference to non-existing document bar
- Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
- SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
- SDField fooRefToBarField = new SDField(
- fooDocument,
- "bar_ref", NewDocumentReferenceDataType.forDocumentName("bar"));
- AttributeUtils.addAttributeAspect(fooRefToBarField);
- fooDocument.addField(fooRefToBarField);
- fooSchema.addDocument(fooDocument);
-
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(singletonList(fooSchema));
-
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "Invalid document reference 'bar_ref': Could not find document type 'bar'");
- resolver.resolveReferences(fooDocument);
+ void throws_user_friendly_exception_if_referenced_document_does_not_exist() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ // Create foo document with document reference to non-existing document bar
+ Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
+ SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
+ SDField fooRefToBarField = new SDField(
+ fooDocument,
+ "bar_ref", NewDocumentReferenceDataType.forDocumentName("bar"));
+ AttributeUtils.addAttributeAspect(fooRefToBarField);
+ fooDocument.addField(fooRefToBarField);
+ fooSchema.addDocument(fooDocument);
+
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(singletonList(fooSchema));
+ resolver.resolveReferences(fooDocument);
+ });
+ assertTrue(exception.getMessage().contains("Invalid document reference 'bar_ref': Could not find document type 'bar'"));
}
@Test
- public void throws_exception_if_reference_is_not_an_attribute() {
- // Create bar document with no fields
- Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty());
- SDDocumentType barDocument = new SDDocumentType("bar", barSchema);
- barSchema.addDocument(barDocument);
-
- // Create foo document with document reference to bar
- Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
- SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
- SDField fooRefToBarField = new SDField
- (fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
- fooDocument.addField(fooRefToBarField);
- fooSchema.addDocument(fooDocument);
-
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(asList(fooSchema, barSchema));
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "The field 'bar_ref' is an invalid document reference. The field must be an attribute.");
- resolver.resolveReferences(fooDocument);
+ void throws_exception_if_reference_is_not_an_attribute() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ // Create bar document with no fields
+ Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty());
+ SDDocumentType barDocument = new SDDocumentType("bar", barSchema);
+ barSchema.addDocument(barDocument);
+
+ // Create foo document with document reference to bar
+ Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty());
+ SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
+ SDField fooRefToBarField = new SDField
+ (fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
+ fooDocument.addField(fooRefToBarField);
+ fooSchema.addDocument(fooDocument);
+
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(asList(fooSchema, barSchema));
+ resolver.resolveReferences(fooDocument);
+ });
+ assertTrue(exception.getMessage().contains("The field 'bar_ref' is an invalid document reference. The field must be an attribute."));
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/FeatureNamesTestCase.java b/config-model/src/test/java/com/yahoo/schema/FeatureNamesTestCase.java
index bff4b434408..0bfd1b1e201 100644
--- a/config-model/src/test/java/com/yahoo/schema/FeatureNamesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/FeatureNamesTestCase.java
@@ -1,15 +1,13 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.util.function.Function;
import java.util.regex.Pattern;
-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.*;
/**
* Tests rank feature names.
@@ -19,7 +17,7 @@ import static org.junit.Assert.assertTrue;
public class FeatureNamesTestCase {
@Test
- public void testArgument() {
+ void testArgument() {
assertFalse(FeatureNames.argumentOf("foo(bar)").isPresent());
assertFalse(FeatureNames.argumentOf("foo(bar.baz)").isPresent());
assertEquals("bar", FeatureNames.argumentOf("query(bar)").get());
@@ -31,25 +29,25 @@ public class FeatureNamesTestCase {
}
@Test
- public void testConstantFeature() {
+ void testConstantFeature() {
assertEquals("constant(foo)",
- FeatureNames.asConstantFeature("foo").toString());
+ FeatureNames.asConstantFeature("foo").toString());
}
@Test
- public void testAttributeFeature() {
+ void testAttributeFeature() {
assertEquals("attribute(foo)",
- FeatureNames.asAttributeFeature("foo").toString());
+ FeatureNames.asAttributeFeature("foo").toString());
}
@Test
- public void testQueryFeature() {
+ void testQueryFeature() {
assertEquals("query(\"foo.bar\")",
- FeatureNames.asQueryFeature("foo.bar").toString());
+ FeatureNames.asQueryFeature("foo.bar").toString());
}
@Test
- public void testLegalFeatureNames() {
+ void testLegalFeatureNames() {
assertTrue(FeatureNames.notNeedQuotes("_"));
assertFalse(FeatureNames.notNeedQuotes("-"));
assertTrue(FeatureNames.notNeedQuotes("_-"));
@@ -57,15 +55,15 @@ public class FeatureNamesTestCase {
assertFalse(FeatureNames.notNeedQuotes("0_-azAZxy98-_+"));
}
- @Test
- @Ignore
/*
* Unignore to verify performance
* 2021/09/05 performance was a factor of 5.25
* 'Identifier handcoded validity check took 4301ms
* Identifier regexp validity check took 22609ms'
*/
- public void benchMarkPatternMatching() {
+ @Test
+ @Disabled
+ void benchMarkPatternMatching() {
Pattern identifierRegexp = Pattern.compile("[A-Za-z0-9_][A-Za-z0-9_-]*");
String[] strings = new String[1000];
for (int i = 0; i < strings.length; i++) {
diff --git a/config-model/src/test/java/com/yahoo/schema/FieldOfTypeDocumentTestCase.java b/config-model/src/test/java/com/yahoo/schema/FieldOfTypeDocumentTestCase.java
index 4a590288d53..ed4cb70c3c7 100644
--- a/config-model/src/test/java/com/yahoo/schema/FieldOfTypeDocumentTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/FieldOfTypeDocumentTestCase.java
@@ -8,13 +8,14 @@ import com.yahoo.document.DocumentTypeManagerConfigurer;
import com.yahoo.document.Field;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.schema.derived.Deriver;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-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 Einar M R Rosenvinge
@@ -22,14 +23,14 @@ import static org.junit.Assert.assertSame;
public class FieldOfTypeDocumentTestCase extends AbstractSchemaTestCase {
@Test
- public void testDocument() throws IOException {
+ void testDocument() throws IOException {
List<String> sds = new ArrayList<>();
sds.add("src/test/examples/music.sd");
sds.add("src/test/examples/fieldoftypedocument.sd");
DocumentmanagerConfig.Builder value = Deriver.getDocumentManagerConfig(sds);
assertConfigFile("src/test/examples/fieldoftypedocument.cfg",
- new DocumentmanagerConfig(value).toString() + "\n");
+ new DocumentmanagerConfig(value).toString() + "\n");
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "raw:" + new DocumentmanagerConfig(value).toString());
diff --git a/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java b/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
index 92d11b3a18a..092891f1ea1 100644
--- a/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
@@ -6,18 +6,18 @@ import com.yahoo.document.DataType;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporaryImportedField;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.List;
-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;
public class ImportedFieldsEnumeratorTest {
@Test
- public void imported_fields_are_enumerated_and_copied_from_correct_search_instance() {
+ void imported_fields_are_enumerated_and_copied_from_correct_search_instance() {
String PARENT = "parent";
Schema parentSchema = new Schema(PARENT, MockApplicationPackage.createEmpty());
SDDocumentType parentDocument = new SDDocumentType(PARENT, parentSchema);
diff --git a/config-model/src/test/java/com/yahoo/schema/IncorrectRankingExpressionFileRefTestCase.java b/config-model/src/test/java/com/yahoo/schema/IncorrectRankingExpressionFileRefTestCase.java
index 87e168adb66..d70abbd6d3f 100644
--- a/config-model/src/test/java/com/yahoo/schema/IncorrectRankingExpressionFileRefTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/IncorrectRankingExpressionFileRefTestCase.java
@@ -5,12 +5,12 @@ import com.yahoo.search.query.profile.QueryProfileRegistry;
import com.yahoo.schema.derived.DerivedConfiguration;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.yolean.Exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -18,12 +18,12 @@ import static org.junit.Assert.fail;
public class IncorrectRankingExpressionFileRefTestCase extends AbstractSchemaTestCase {
@Test
- public void testIncorrectRef() throws IOException, ParseException {
+ void testIncorrectRef() throws IOException, ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/incorrectrankingexpressionfileref.sd",
- registry,
- new QueryProfileRegistry());
+ registry,
+ new QueryProfileRegistry());
new DerivedConfiguration(schema, registry); // cause rank profile parsing
fail("parsing should have failed");
} catch (IllegalArgumentException e) {
diff --git a/config-model/src/test/java/com/yahoo/schema/IncorrectSummaryTypesTestCase.java b/config-model/src/test/java/com/yahoo/schema/IncorrectSummaryTypesTestCase.java
index e58cce6472a..acc872f6798 100644
--- a/config-model/src/test/java/com/yahoo/schema/IncorrectSummaryTypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/IncorrectSummaryTypesTestCase.java
@@ -2,10 +2,11 @@
package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
/**
* Tests importing a search definition with conflicting summary types
*
@@ -13,20 +14,20 @@ import static org.junit.Assert.fail;
*/
public class IncorrectSummaryTypesTestCase extends AbstractSchemaTestCase {
@Test
- public void testImportingIncorrect() throws ParseException {
+ void testImportingIncorrect() throws ParseException {
try {
ApplicationBuilder.createFromString(
"search incorrectsummarytypes {\n" +
- " document incorrectsummarytypes {\n" +
- " field somestring type string {\n" +
- " indexing: summary\n" +
- " }\n" +
- " }\n" +
- " document-summary incorrect {\n" +
- " summary somestring type int {\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document incorrectsummarytypes {\n" +
+ " field somestring type string {\n" +
+ " indexing: summary\n" +
+ " }\n" +
+ " }\n" +
+ " document-summary incorrect {\n" +
+ " summary somestring type int {\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
fail("processing should have failed");
} catch (RuntimeException e) {
assertEquals("'summary somestring type string' in 'destinations(default )' is inconsistent with 'summary somestring type int' in 'destinations(incorrect )': All declarations of the same summary field must have the same type", e.getMessage());
diff --git a/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java b/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
index 6082372b428..b1d502dec36 100644
--- a/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
@@ -4,13 +4,13 @@ package com.yahoo.schema;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.Stemming;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-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;
/**
* Rank settings
@@ -20,24 +20,24 @@ import static org.junit.Assert.assertTrue;
public class IndexSettingsTestCase extends AbstractSchemaTestCase {
@Test
- public void testStemmingSettings() throws IOException, ParseException {
+ void testStemmingSettings() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/indexsettings.sd");
- SDField usingDefault=(SDField) schema.getDocument().getField("usingdefault");
- assertEquals(Stemming.SHORTEST,usingDefault.getStemming(schema));
+ SDField usingDefault = (SDField) schema.getDocument().getField("usingdefault");
+ assertEquals(Stemming.SHORTEST, usingDefault.getStemming(schema));
- SDField notStemmed=(SDField) schema.getDocument().getField("notstemmed");
- assertEquals(Stemming.NONE,notStemmed.getStemming(schema));
+ SDField notStemmed = (SDField) schema.getDocument().getField("notstemmed");
+ assertEquals(Stemming.NONE, notStemmed.getStemming(schema));
- SDField allStemmed=(SDField) schema.getDocument().getField("allstemmed");
- assertEquals(Stemming.SHORTEST,allStemmed.getStemming(schema));
+ SDField allStemmed = (SDField) schema.getDocument().getField("allstemmed");
+ assertEquals(Stemming.SHORTEST, allStemmed.getStemming(schema));
- SDField multiStemmed=(SDField) schema.getDocument().getField("multiplestems");
+ SDField multiStemmed = (SDField) schema.getDocument().getField("multiplestems");
assertEquals(Stemming.MULTIPLE, multiStemmed.getStemming(schema));
}
@Test
- public void requireThatInterlavedFeaturesAreSetOnExtraField() throws ParseException {
+ void requireThatInterlavedFeaturesAreSetOnExtraField() throws ParseException {
ApplicationBuilder builder = ApplicationBuilder.createFromString(joinLines(
"search test {",
" document test {",
diff --git a/config-model/src/test/java/com/yahoo/schema/IndexingParsingTestCase.java b/config-model/src/test/java/com/yahoo/schema/IndexingParsingTestCase.java
index 6a51000fffe..fcbea179810 100644
--- a/config-model/src/test/java/com/yahoo/schema/IndexingParsingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/IndexingParsingTestCase.java
@@ -2,9 +2,9 @@
package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Tests that indexing statements are parsed correctly.
@@ -14,12 +14,12 @@ import static org.junit.Assert.assertNotNull;
public class IndexingParsingTestCase extends AbstractSchemaTestCase {
@Test
- public void requireThatIndexingExpressionsCanBeParsed() throws Exception {
+ void requireThatIndexingExpressionsCanBeParsed() throws Exception {
assertNotNull(ApplicationBuilder.buildFromFile("src/test/examples/indexing.sd"));
}
@Test
- public void requireThatParseExceptionPositionIsCorrect() throws Exception {
+ void requireThatParseExceptionPositionIsCorrect() throws Exception {
try {
ApplicationBuilder.buildFromFile("src/test/examples/indexing_invalid_expression.sd");
} catch (ParseException e) {
diff --git a/config-model/src/test/java/com/yahoo/schema/MultipleSummariesTestCase.java b/config-model/src/test/java/com/yahoo/schema/MultipleSummariesTestCase.java
index 6d6249dc372..fb3257bf4b4 100644
--- a/config-model/src/test/java/com/yahoo/schema/MultipleSummariesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/MultipleSummariesTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,7 +15,7 @@ import java.io.IOException;
public class MultipleSummariesTestCase extends AbstractSchemaTestCase {
@Test
- public void testArrayImporting() throws IOException, ParseException {
+ void testArrayImporting() throws IOException, ParseException {
var builder = new ApplicationBuilder(new TestProperties());
builder.addSchemaFile("src/test/examples/multiplesummaries.sd");
builder.build(true);
diff --git a/config-model/src/test/java/com/yahoo/schema/NameFieldCheckTestCase.java b/config-model/src/test/java/com/yahoo/schema/NameFieldCheckTestCase.java
index 9b4b6864309..8de95945a18 100644
--- a/config-model/src/test/java/com/yahoo/schema/NameFieldCheckTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/NameFieldCheckTestCase.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.schema;
-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.*;
/**
* Tests that "name" is not allowed as name for a field.
@@ -17,20 +15,20 @@ import static org.junit.Assert.fail;
public class NameFieldCheckTestCase extends AbstractSchemaTestCase {
@Test
- public void testNameField() {
+ void testNameField() {
try {
ApplicationBuilder.createFromString(
"search simple {\n" +
- " document name-check {\n" +
- " field title type string {\n" +
- " indexing: summary | index\n" +
- " }\n" +
- " # reserved name, should trigger error\n" +
- " field sddocname type string {\n" +
- " indexing: index\n" +
- " }\n" +
- " }\n" +
- "}");
+ " document name-check {\n" +
+ " field title type string {\n" +
+ " indexing: summary | index\n" +
+ " }\n" +
+ " # reserved name, should trigger error\n" +
+ " field sddocname type string {\n" +
+ " indexing: index\n" +
+ " }\n" +
+ " }\n" +
+ "}");
fail("Should throw exception.");
} catch (Exception expected) {
// Success
@@ -38,39 +36,39 @@ public class NameFieldCheckTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testDuplicateNamesInSearchDifferentType() {
+ void testDuplicateNamesInSearchDifferentType() {
try {
ApplicationBuilder.createFromString(
"search duplicatenamesinsearch {\n" +
- " document {\n" +
- " field grpphotoids64 type string { }\n" +
- " }\n" +
- " field grpphotoids64 type array<long> {\n" +
- " indexing: input grpphotoids64 | split \" \" | for_each {\n" +
- " base64decode } | attribute\n" +
- " }\n" +
- "}");
+ " document {\n" +
+ " field grpphotoids64 type string { }\n" +
+ " }\n" +
+ " field grpphotoids64 type array<long> {\n" +
+ " indexing: input grpphotoids64 | split \" \" | for_each {\n" +
+ " base64decode } | attribute\n" +
+ " }\n" +
+ "}");
fail("Should throw exception.");
} catch (Exception e) {
assertEquals("For schema 'duplicatenamesinsearch', field 'grpphotoids64': " +
- "Incompatible types. Expected Array<long> for index field 'grpphotoids64', got string.", e.getMessage());
+ "Incompatible types. Expected Array<long> for index field 'grpphotoids64', got string.", e.getMessage());
}
}
@Test
- public void testDuplicateNamesInDoc() {
+ void testDuplicateNamesInDoc() {
try {
ApplicationBuilder.createFromString(
"search duplicatenamesindoc {\n" +
- " document {\n" +
- " field foo type int {\n" +
- " indexing: attribute\n" +
- " }\n" +
- " field fOo type string {\n" +
- " indexing: index\n" +
- " }\n" +
- " }\n" +
- "}");
+ " document {\n" +
+ " field foo type int {\n" +
+ " indexing: attribute\n" +
+ " }\n" +
+ " field fOo type string {\n" +
+ " indexing: index\n" +
+ " }\n" +
+ " }\n" +
+ "}");
fail("Should throw exception.");
} catch (Exception e) {
assertTrue(e.getMessage().matches(".*Duplicate.*"));
diff --git a/config-model/src/test/java/com/yahoo/schema/OutsideTestCase.java b/config-model/src/test/java/com/yahoo/schema/OutsideTestCase.java
index 0c0684e23e3..8509c1972a8 100644
--- a/config-model/src/test/java/com/yahoo/schema/OutsideTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/OutsideTestCase.java
@@ -2,12 +2,13 @@
package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
+
/**
* Tests settings outside the document
*
@@ -16,16 +17,16 @@ import static org.junit.Assert.assertTrue;
public class OutsideTestCase extends AbstractSchemaTestCase {
@Test
- public void testOutsideIndex() throws IOException, ParseException {
+ void testOutsideIndex() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/outsidedoc.sd");
- Index defaultIndex= schema.getIndex("default");
+ Index defaultIndex = schema.getIndex("default");
assertTrue(defaultIndex.isPrefix());
- assertEquals("default.default",defaultIndex.aliasIterator().next());
+ assertEquals("default.default", defaultIndex.aliasIterator().next());
}
@Test
- public void testOutsideSummary() throws IOException, ParseException {
+ void testOutsideSummary() throws IOException, ParseException {
ApplicationBuilder.buildFromFile("src/test/examples/outsidesummary.sd");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/PredicateDataTypeTestCase.java b/config-model/src/test/java/com/yahoo/schema/PredicateDataTypeTestCase.java
index dbea8fb8aeb..f59938e9a41 100644
--- a/config-model/src/test/java/com/yahoo/schema/PredicateDataTypeTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/PredicateDataTypeTestCase.java
@@ -2,17 +2,12 @@
package com.yahoo.schema;
import com.yahoo.schema.document.ImmutableSDField;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import com.yahoo.document.DataType;
import com.yahoo.schema.parser.ParseException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Lester Solbakken
@@ -52,25 +47,21 @@ public class PredicateDataTypeTestCase {
return "upper-bound: " + bound + "\n";
}
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
@Test
- public void requireThatBuilderSetsIndexParametersCorrectly() throws ParseException {
+ void requireThatBuilderSetsIndexParametersCorrectly() throws ParseException {
int arity = 2;
long lowerBound = -100;
long upperBound = 100;
String sd = searchSd(
- predicateFieldSd(
- attributeFieldSd(
- arityParameter(arity) +
- lowerBoundParameter(lowerBound) +
- upperBoundParameter(upperBound))));
+ predicateFieldSd(
+ attributeFieldSd(
+ arityParameter(arity) +
+ lowerBoundParameter(lowerBound) +
+ upperBoundParameter(upperBound))));
ApplicationBuilder sb = ApplicationBuilder.createFromString(sd);
for (ImmutableSDField field : sb.getSchema().allConcreteFields()) {
- if (field.getDataType() == DataType.PREDICATE) {
+ if (field.getDataType() == DataType.PREDICATE) {
for (Index index : field.getIndices().values()) {
assertTrue(index.getBooleanIndexDefiniton().hasArity());
assertEquals(arity, index.getBooleanIndexDefiniton().getArity());
@@ -84,20 +75,20 @@ public class PredicateDataTypeTestCase {
}
@Test
- public void requireThatBuilderHandlesLongValues() throws ParseException {
+ void requireThatBuilderHandlesLongValues() throws ParseException {
int arity = 2;
long lowerBound = -100000000000000000L;
long upperBound = 1000000000000000000L;
String sd = searchSd(
- predicateFieldSd(
- attributeFieldSd(
- arityParameter(arity) +
- "lower-bound: -100000000000000000L\n" + // +'L'
- upperBoundParameter(upperBound))));
+ predicateFieldSd(
+ attributeFieldSd(
+ arityParameter(arity) +
+ "lower-bound: -100000000000000000L\n" + // +'L'
+ upperBoundParameter(upperBound))));
ApplicationBuilder sb = ApplicationBuilder.createFromString(sd);
for (ImmutableSDField field : sb.getSchema().allConcreteFields()) {
- if (field.getDataType() == DataType.PREDICATE) {
+ if (field.getDataType() == DataType.PREDICATE) {
for (Index index : field.getIndices().values()) {
assertEquals(arity, index.getBooleanIndexDefiniton().getArity());
assertEquals(lowerBound, index.getBooleanIndexDefiniton().getLowerBound());
@@ -108,11 +99,11 @@ public class PredicateDataTypeTestCase {
}
@Test
- public void requireThatBuilderHandlesMissingParameters() throws ParseException {
+ void requireThatBuilderHandlesMissingParameters() throws ParseException {
String sd = searchSd(
- predicateFieldSd(
- attributeFieldSd(
- arityParameter(2))));
+ predicateFieldSd(
+ attributeFieldSd(
+ arityParameter(2))));
ApplicationBuilder sb = ApplicationBuilder.createFromString(sd);
for (ImmutableSDField field : sb.getSchema().allConcreteFields()) {
if (field.getDataType() == DataType.PREDICATE) {
@@ -126,74 +117,74 @@ public class PredicateDataTypeTestCase {
}
@Test
- public void requireThatBuilderFailsIfNoArityValue() throws ParseException {
- String sd = searchSd(predicateFieldSd(attributeFieldSd("")));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Missing arity value in predicate field.");
- ApplicationBuilder.createFromString(sd);
- fail();
+ void requireThatBuilderFailsIfNoArityValue() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(predicateFieldSd(attributeFieldSd("")));
+ ApplicationBuilder.createFromString(sd);
+ fail();
+ });
+ assertTrue(exception.getMessage().contains("Missing arity value in predicate field."));
}
@Test
- public void requireThatBuilderFailsIfBothIndexAndAttribute() throws ParseException {
- String sd = searchSd(predicateFieldSd("indexing: summary | index | attribute\nindex { arity: 2 }"));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded.");
- ApplicationBuilder.createFromString(sd);
+ void requireThatBuilderFailsIfBothIndexAndAttribute() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(predicateFieldSd("indexing: summary | index | attribute\nindex { arity: 2 }"));
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."));
}
@Test
- public void requireThatBuilderFailsIfIndex() throws ParseException {
- String sd = searchSd(predicateFieldSd("indexing: summary | index \nindex { arity: 2 }"));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded.");
- ApplicationBuilder.createFromString(sd);
+ void requireThatBuilderFailsIfIndex() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(predicateFieldSd("indexing: summary | index \nindex { arity: 2 }"));
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("For schema 'p', field 'pf': Use 'attribute' instead of 'index'. This will require a refeed if you have upgraded."));
}
@Test
- public void requireThatBuilderFailsIfIllegalArityValue() throws ParseException {
- String sd = searchSd(predicateFieldSd(attributeFieldSd(arityParameter(0))));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Invalid arity value in predicate field, must be greater than 1.");
- ApplicationBuilder.createFromString(sd);
+ void requireThatBuilderFailsIfIllegalArityValue() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(predicateFieldSd(attributeFieldSd(arityParameter(0))));
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("Invalid arity value in predicate field, must be greater than 1."));
}
@Test
- public void requireThatBuilderFailsIfArityParameterExistButNotPredicateField() throws ParseException {
- String sd = searchSd(stringFieldSd(attributeFieldSd(arityParameter(2))));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Arity parameter is used only for predicate type fields.");
- ApplicationBuilder.createFromString(sd);
+ void requireThatBuilderFailsIfArityParameterExistButNotPredicateField() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(stringFieldSd(attributeFieldSd(arityParameter(2))));
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("Arity parameter is used only for predicate type fields."));
}
@Test
- public void requireThatBuilderFailsIfBoundParametersExistButNotPredicateField() throws ParseException {
- String sd = searchSd(
- stringFieldSd(
+ void requireThatBuilderFailsIfBoundParametersExistButNotPredicateField() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(
+ stringFieldSd(
attributeFieldSd(
lowerBoundParameter(100) + upperBoundParameter(1000))));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Parameters lower-bound and upper-bound are used only for predicate type fields.");
- ApplicationBuilder.createFromString(sd);
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("Parameters lower-bound and upper-bound are used only for predicate type fields."));
}
@Test
- public void requireThatArrayOfPredicateFails() throws ParseException {
- String sd = searchSd(
- arrayPredicateFieldSd(
- attributeFieldSd(
- arityParameter(1))));
-
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Collections of predicates are not allowed.");
- ApplicationBuilder.createFromString(sd);
+ void requireThatArrayOfPredicateFails() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String sd = searchSd(
+ arrayPredicateFieldSd(
+ attributeFieldSd(
+ arityParameter(1))));
+ ApplicationBuilder.createFromString(sd);
+ });
+ assertTrue(exception.getMessage().contains("Collections of predicates are not allowed."));
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/RankProfileRegistryTest.java b/config-model/src/test/java/com/yahoo/schema/RankProfileRegistryTest.java
index de061defb87..b73f5412bba 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankProfileRegistryTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankProfileRegistryTest.java
@@ -8,13 +8,11 @@ import com.yahoo.config.model.test.TestRoot;
import com.yahoo.searchlib.rankingexpression.ExpressionFunction;
import com.yahoo.searchlib.rankingexpression.RankingExpression;
import com.yahoo.vespa.config.search.RankProfilesConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Ulf Lilleengen
@@ -24,7 +22,7 @@ public class RankProfileRegistryTest {
private static final String TESTDIR = "src/test/cfg/search/data/v2/inherited_rankprofiles";
@Test
- public void testRankProfileInheritance() {
+ void testRankProfileInheritance() {
TestRoot root = new TestDriver().buildModel(FilesApplicationPackage.fromFile(new File(TESTDIR)));
RankProfilesConfig left = root.getConfig(RankProfilesConfig.class, "inherit/search/cluster.inherit/left");
RankProfilesConfig right = root.getConfig(RankProfilesConfig.class, "inherit/search/cluster.inherit/right");
@@ -32,17 +30,19 @@ public class RankProfileRegistryTest {
assertEquals(2, right.rankprofile().size());
}
- @Test(expected = IllegalArgumentException.class)
- public void testRankProfileDuplicateNameIsIllegal() {
- Schema schema = new Schema("foo", MockApplicationPackage.createEmpty());
- RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
- RankProfile barRankProfile = new RankProfile("bar", schema, rankProfileRegistry);
- rankProfileRegistry.add(barRankProfile);
- rankProfileRegistry.add(barRankProfile);
+ @Test
+ void testRankProfileDuplicateNameIsIllegal() {
+ assertThrows(IllegalArgumentException.class, () -> {
+ Schema schema = new Schema("foo", MockApplicationPackage.createEmpty());
+ RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
+ RankProfile barRankProfile = new RankProfile("bar", schema, rankProfileRegistry);
+ rankProfileRegistry.add(barRankProfile);
+ rankProfileRegistry.add(barRankProfile);
+ });
}
@Test
- public void testRankProfileDuplicateNameLegalForOverridableRankProfiles() {
+ void testRankProfileDuplicateNameLegalForOverridableRankProfiles() {
Schema schema = new Schema("foo", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
diff --git a/config-model/src/test/java/com/yahoo/schema/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankProfileTestCase.java
index c66d44556ca..ddca13a2984 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankProfileTestCase.java
@@ -24,17 +24,13 @@ import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
-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.*;
/**
* Tests rank profiles
@@ -44,7 +40,7 @@ import static org.junit.Assert.fail;
public class RankProfileTestCase extends AbstractSchemaTestCase {
@Test
- public void testRankProfileInheritance() {
+ void testRankProfileInheritance() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType document = new SDDocumentType("test");
@@ -68,7 +64,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatIllegalInheritanceIsChecked() throws ParseException {
+ void requireThatIllegalInheritanceIsChecked() throws ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
@@ -85,7 +81,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatSelfInheritanceIsIllegal() throws ParseException {
+ void requireThatSelfInheritanceIsIllegal() throws ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
@@ -102,7 +98,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatSelfInheritanceIsLegalWhenOverloading() throws ParseException {
+ void requireThatSelfInheritanceIsLegalWhenOverloading() throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
builder.addSchema(joinLines(
@@ -119,7 +115,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatSidewaysInheritanceIsImpossible() throws ParseException {
+ void requireThatSidewaysInheritanceIsImpossible() throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
builder.addSchema(joinLines(
@@ -172,7 +168,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatDefaultInheritingDefaultIsIgnored() throws ParseException {
+ void requireThatDefaultInheritingDefaultIsIgnored() throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
builder.addSchema(joinLines(
@@ -184,7 +180,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatCyclicInheritanceIsIllegal() throws ParseException {
+ void requireThatCyclicInheritanceIsIllegal() throws ParseException {
try {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
@@ -203,7 +199,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatRankProfilesCanInheritNotYetSeenProfiles() throws ParseException
+ void requireThatRankProfilesCanInheritNotYetSeenProfiles() throws ParseException
{
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
@@ -214,9 +210,9 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
" rank-profile not_yet_defined {}",
"}"));
builder.build(true);
- assertNotNull(registry.get("test","p1"));
- assertTrue(registry.get("test","p1").inherits("not_yet_defined"));
- assertNotNull(registry.get("test","not_yet_defined"));
+ assertNotNull(registry.get("test", "p1"));
+ assertTrue(registry.get("test", "p1").inherits("not_yet_defined"));
+ assertNotNull(registry.get("test", "not_yet_defined"));
}
private String createSD(Double termwiseLimit) {
@@ -239,7 +235,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testTermwiseLimitWithDeployOverride() throws ParseException {
+ void testTermwiseLimitWithDeployOverride() throws ParseException {
verifyTermwiseLimitAndSomeMoreIncludingInheritance(new TestProperties(), createSD(null), null);
verifyTermwiseLimitAndSomeMoreIncludingInheritance(new TestProperties(), createSD(0.78), 0.78);
verifyTermwiseLimitAndSomeMoreIncludingInheritance(new TestProperties().setDefaultTermwiseLimit(0.09), createSD(null), 0.09);
@@ -279,7 +275,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatConfigIsDerivedForAttributeTypeSettings() throws ParseException {
+ void requireThatConfigIsDerivedForAttributeTypeSettings() throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry);
builder.addSchema(joinLines(
@@ -303,7 +299,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatDenseDimensionsMustBeBound() throws ParseException {
+ void requireThatDenseDimensionsMustBeBound() throws ParseException {
try {
ApplicationBuilder builder = new ApplicationBuilder(new RankProfileRegistry());
builder.addSchema(joinLines(
@@ -316,7 +312,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
catch (IllegalArgumentException e) {
assertEquals("Illegal type in field a type tensor(x[]): Dense tensor dimensions must have a size",
- e.getMessage());
+ e.getMessage());
}
}
@@ -332,7 +328,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatConfigIsDerivedForQueryFeatureTypeSettings() throws ParseException {
+ void requireThatConfigIsDerivedForQueryFeatureTypeSettings() throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(registry, setupQueryProfileTypes());
builder.addSchema(joinLines(
@@ -386,7 +382,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase {
}
@Test
- public void approximate_nearest_neighbor_threshold_settings_are_configurable() throws ParseException {
+ void approximate_nearest_neighbor_threshold_settings_are_configurable() throws ParseException {
verifyApproximateNearestNeighborThresholdSettings(0.7, null);
verifyApproximateNearestNeighborThresholdSettings(null, 0.3);
verifyApproximateNearestNeighborThresholdSettings(0.7, 0.3);
diff --git a/config-model/src/test/java/com/yahoo/schema/RankPropertiesTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankPropertiesTestCase.java
index c3595717220..06fa63707c0 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankPropertiesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankPropertiesTestCase.java
@@ -8,12 +8,12 @@ import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.parser.ParseException;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author bratseth
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals;
public class RankPropertiesTestCase extends AbstractSchemaTestCase {
@Test
- public void testRankPropertyInheritance() throws ParseException {
+ void testRankPropertyInheritance() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(joinLines(
@@ -69,16 +69,17 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase {
// Check derived model
RawRankProfile rawChild = new RawRankProfile(rankProfileRegistry.get(schema, "child"),
- new LargeRankExpressions(new MockFileRegistry()),
- new QueryProfileRegistry(),
- new ImportedMlModels(),
- attributeFields,
- new TestProperties());
+ new LargeRankExpressions(new MockFileRegistry()),
+ new QueryProfileRegistry(),
+ new ImportedMlModels(),
+ attributeFields,
+ new TestProperties());
assertEquals("(query(a), 2000)", rawChild.configProperties().get(0).toString());
}
}
+
@Test
- public void testRankProfileMutate() throws ParseException {
+ void testRankProfileMutate() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(joinLines(
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingConstantTest.java b/config-model/src/test/java/com/yahoo/schema/RankingConstantTest.java
index 883e6b50abb..c963f086ac4 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingConstantTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingConstantTest.java
@@ -2,28 +2,20 @@
package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.util.Iterator;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author gjoranv
*/
public class RankingConstantTest {
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
- public void tensor_constant_properties_are_set() throws Exception {
+ void tensor_constant_properties_are_set() throws Exception {
final String TENSOR_NAME = "my_global_tensor";
final String TENSOR_FILE = "path/my-tensor-file.json";
final String TENSOR_TYPE = "tensor(x{})";
@@ -57,39 +49,41 @@ public class RankingConstantTest {
}
@Test
- public void tensor_constant_must_have_a_type() throws Exception {
- RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
- ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
- thrown.expect(IllegalArgumentException.class);
- thrown.expectMessage("must have a type");
- schemaBuilder.addSchema(joinLines(
- "schema test {",
- " document test { }",
- " constant foo {",
- " file: bar.baz",
- " }",
- "}"
- ));
+ void tensor_constant_must_have_a_type() throws Exception {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
+ ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
+ schemaBuilder.addSchema(joinLines(
+ "schema test {",
+ " document test { }",
+ " constant foo {",
+ " file: bar.baz",
+ " }",
+ "}"
+ ));
+ });
+ assertTrue(exception.getMessage().contains("must have a type"));
}
@Test
- public void tensor_constant_must_have_a_file() throws Exception {
- RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
- ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
- thrown.expect(IllegalArgumentException.class);
- thrown.expectMessage("must have a file");
- schemaBuilder.addSchema(joinLines(
- "schema test {",
- " document test { }",
- " constant foo {",
- " type: tensor(x[])",
- " }",
- "}"
- ));
+ void tensor_constant_must_have_a_file() throws Exception {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
+ ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
+ schemaBuilder.addSchema(joinLines(
+ "schema test {",
+ " document test { }",
+ " constant foo {",
+ " type: tensor(x[])",
+ " }",
+ "}"
+ ));
+ });
+ assertTrue(exception.getMessage().contains("must have a file"));
}
@Test
- public void constant_file_does_not_need_path_or_ending() throws Exception {
+ void constant_file_does_not_need_path_or_ending() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
schemaBuilder.addSchema(joinLines(
@@ -108,7 +102,7 @@ public class RankingConstantTest {
}
@Test
- public void constant_uri_is_allowed() throws Exception {
+ void constant_uri_is_allowed() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
schemaBuilder.addSchema(joinLines(
@@ -128,7 +122,7 @@ public class RankingConstantTest {
}
@Test
- public void constant_https_uri_is_allowed() throws Exception {
+ void constant_https_uri_is_allowed() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
schemaBuilder.addSchema(joinLines(
@@ -148,7 +142,7 @@ public class RankingConstantTest {
}
@Test
- public void constant_uri_with_port_is_allowed() throws Exception {
+ void constant_uri_with_port_is_allowed() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
schemaBuilder.addSchema(joinLines(
@@ -168,7 +162,7 @@ public class RankingConstantTest {
}
@Test
- public void constant_uri_no_dual_slashes_is_allowed() throws Exception {
+ void constant_uri_no_dual_slashes_is_allowed() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
schemaBuilder.addSchema(joinLines(
@@ -188,7 +182,7 @@ public class RankingConstantTest {
}
@Test
- public void constant_uri_only_supports_http_and_https() {
+ void constant_uri_only_supports_http_and_https() {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder schemaBuilder = new ApplicationBuilder(rankProfileRegistry);
String expectedMessage = "Encountered \" <IDENTIFIER> \"ftp\"\" at line 5, column 10.\n\n" +
@@ -205,7 +199,7 @@ public class RankingConstantTest {
"}"
));
} catch (ParseException e) {
- if (! e.getMessage().startsWith(expectedMessage))
+ if (!e.getMessage().startsWith(expectedMessage))
fail("Expected exception with message starting with:\n'" + expectedMessage + "\nBut got:\n'" + e.getMessage());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionConstantsTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionConstantsTestCase.java
index bd0bd65295c..c915a85a4cf 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionConstantsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionConstantsTestCase.java
@@ -10,11 +10,12 @@ import com.yahoo.yolean.Exceptions;
import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.parser.ParseException;
-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.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -22,7 +23,7 @@ import static org.junit.Assert.*;
public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
@Test
- public void testConstants() throws ParseException {
+ void testConstants() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
QueryProfileRegistry queryProfileRegistry = new QueryProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
@@ -89,7 +90,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testNameCollision() throws ParseException {
+ void testNameCollision() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -118,12 +119,12 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
}
catch (IllegalArgumentException e) {
assertEquals("Rank profile 'test' is invalid: Cannot have both a constant and function named 'c'",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testNegativeLiteralArgument() throws ParseException {
+ void testNegativeLiteralArgument() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -148,7 +149,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testNegativeConstantArgument() throws ParseException {
+ void testNegativeConstantArgument() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -174,11 +175,11 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("safeLog(popShareSlowDecaySignal,myValue)", profile.getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString());
assertEquals("safeLog(popShareSlowDecaySignal,-9.21034037)",
- profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString());
+ profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString());
}
@Test
- public void testConstantDivisorInFunction() throws ParseException {
+ void testConstantDivisorInFunction() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -197,11 +198,11 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("k1 + (k2 + k3) / 1.0E8",
- profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("rank_default").function().getBody().getRoot().toString());
+ profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("rank_default").function().getBody().getRoot().toString());
}
@Test
- public void test3() throws ParseException {
+ void test3() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -223,7 +224,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase {
Schema s = builder.getSchema();
RankProfile profile = rankProfileRegistry.get(s, "test");
assertEquals("0.5 + 50 * (attribute(rating_yelp) - 3)",
- profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("rank_default").function().getBody().getRoot().toString());
+ profile.compile(new QueryProfileRegistry(), new ImportedMlModels()).getFunctions().get("rank_default").function().getBody().getRoot().toString());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java
index 79c803e007c..789c4ac5577 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionInliningTestCase.java
@@ -11,15 +11,13 @@ import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.parser.ParseException;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Optional;
import java.util.logging.Level;
-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 bratseth
@@ -27,11 +25,11 @@ import static org.junit.Assert.fail;
public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
@Test
- public void testFunctionInliningPreserveArithmeticOrdering() throws ParseException {
+ void testFunctionInliningPreserveArithmeticOrdering() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
- "search test {\n" +
+ "search test {\n" +
" document test { \n" +
" field a type double { \n" +
" indexing: attribute \n" +
@@ -71,14 +69,14 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels());
assertEquals("7.0 * (3 + attribute(a) + attribute(b) * (attribute(a) * 3 + if (7.0 < attribute(a), 1, 2) == 0))",
- parent.getFirstPhaseRanking().getRoot().toString());
+ parent.getFirstPhaseRanking().getRoot().toString());
RankProfile child = rankProfileRegistry.get(s, "child").compile(new QueryProfileRegistry(), new ImportedMlModels());
assertEquals("7.0 * (9 + attribute(a))",
- child.getFirstPhaseRanking().getRoot().toString());
+ child.getFirstPhaseRanking().getRoot().toString());
}
@Test
- public void testConstants() throws ParseException {
+ void testConstants() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -149,7 +147,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testNonTopLevelInlining() throws ParseException {
+ void testNonTopLevelInlining() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -192,31 +190,31 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testFunctionRedefinitionIsIllegal() throws ParseException {
+ void testFunctionRedefinitionIsIllegal() throws ParseException {
try {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
MockDeployLogger deployLogger = new MockDeployLogger();
ApplicationBuilder builder = new ApplicationBuilder(MockApplicationPackage.createEmpty(),
- new MockFileRegistry(),
- deployLogger,
- new TestProperties(),
- rankProfileRegistry,
- new QueryProfileRegistry());
+ new MockFileRegistry(),
+ deployLogger,
+ new TestProperties(),
+ rankProfileRegistry,
+ new QueryProfileRegistry());
builder.addSchema(
"search test {\n" +
- " document test { }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " function inline foo() {\n" +
- " expression: foo(2)\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " function inline foo() {\n" +
+ " expression: foo(2)\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
fail("Expected failure");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
index dd69fb6c591..302fda9d3d7 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionLoopDetectionTestCase.java
@@ -3,10 +3,10 @@ package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
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.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -14,232 +14,232 @@ import static org.junit.Assert.fail;
public class RankingExpressionLoopDetectionTestCase {
@Test
- public void testSelfLoop() throws ParseException {
+ void testSelfLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: foo\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: foo is invalid: Invocation loop: foo -> foo",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testNestedLoop() throws ParseException {
+ void testNestedLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: arg(5)\n" +
- " }\n" +
- " function arg(a1) {\n" +
- " expression: foo + a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: arg(5)\n" +
+ " }\n" +
+ " function arg(a1) {\n" +
+ " expression: foo + a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: arg(5) is invalid: foo is invalid: arg(5) is invalid: Invocation loop: arg(5) -> foo -> arg(5)",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testSelfArgumentLoop() throws ParseException {
+ void testSelfArgumentLoop() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: arg(foo)\n" +
- " }\n" +
- " function arg(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: arg(foo)\n" +
+ " }\n" +
+ " function arg(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
try {
builder.build(true);
fail("Excepted exception");
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'test': The function 'foo' is invalid: arg(foo) is invalid: a1 is invalid: foo is invalid: arg(foo) is invalid: Invocation loop: arg(foo) -> foo -> arg(foo)",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void testNoLoopWithSameLocalArgument() throws ParseException {
+ void testNoLoopWithSameLocalArgument() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(3)\n" +
- " }\n" +
- " function foo(a1) {\n" +
- " expression: bar(3)\n" +
- " }\n" +
- " function bar(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(3)\n" +
+ " }\n" +
+ " function foo(a1) {\n" +
+ " expression: bar(3)\n" +
+ " }\n" +
+ " function bar(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithMultipleInvocations() throws ParseException {
+ void testNoLoopWithMultipleInvocations() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " field a type string { \n" +
- " indexing: index \n" +
- " }\n" +
- " }\n" +
- " \n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(3)\n" +
- " }\n" +
- " function foo(a1) {\n" +
- " expression: bar(3) + bar(a1)\n" +
- " }\n" +
- " function bar(a1) {\n" +
- " expression: a1*2\n" +
- " }\n" +
- " }\n" +
- "\n" +
- "}\n");
+ " document test { \n" +
+ " field a type string { \n" +
+ " indexing: index \n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(3)\n" +
+ " }\n" +
+ " function foo(a1) {\n" +
+ " expression: bar(3) + bar(a1)\n" +
+ " }\n" +
+ " function bar(a1) {\n" +
+ " expression: a1*2\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithBoundIdentifiers() throws ParseException {
+ void testNoLoopWithBoundIdentifiers() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo(bar(2))\n" +
- " }\n" +
- " function foo(x) {\n" +
- " expression: x * x\n" +
- " }\n" +
- " function bar(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo(bar(2))\n" +
+ " }\n" +
+ " function foo(x) {\n" +
+ " expression: x * x\n" +
+ " }\n" +
+ " function bar(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException {
+ void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo()\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: bar(x)\n" +
- " }\n" +
- " function bar(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}
@Test
- public void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException {
+ void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
"search test {\n" +
- " document test { \n" +
- " }\n" +
- " rank-profile test {\n" +
- " first-phase {\n" +
- " expression: foo()\n" +
- " }\n" +
- " function foo() {\n" +
- " expression: bar(x)\n" +
- " }\n" +
- " function bar(y) {\n" +
- " expression: baz(y)\n" +
- " }\n" +
- " function baz(x) {\n" +
- " expression: x + x\n" +
- " }\n" +
- " }\n" +
- "}\n");
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(y) {\n" +
+ " expression: baz(y)\n" +
+ " }\n" +
+ " function baz(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
builder.build(true);
}
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionShadowingTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionShadowingTestCase.java
index 250879b1570..33bbdb2fd6f 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionShadowingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionShadowingTestCase.java
@@ -12,11 +12,11 @@ import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.parser.ParseException;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author lesters
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals;
public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
@Test
- public void testBasicFunctionShadowing() throws ParseException {
+ void testBasicFunctionShadowing() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -52,14 +52,14 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
assertEquals("(rankingExpression(sin@).rankingScript, 2 * 2)",
censorBindingHash(testRankProperties.get(0).toString()));
assertEquals("(rankingExpression(sin).rankingScript, x * x)",
- testRankProperties.get(1).toString());
+ testRankProperties.get(1).toString());
assertEquals("(vespa.rank.firstphase, rankingExpression(sin@))",
- censorBindingHash(testRankProperties.get(2).toString()));
+ censorBindingHash(testRankProperties.get(2).toString()));
}
@Test
- public void testMultiLevelFunctionShadowing() throws ParseException {
+ void testMultiLevelFunctionShadowing() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -97,21 +97,21 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
assertEquals("(rankingExpression(sin@).rankingScript, rankingExpression(cos@))",
censorBindingHash(testRankProperties.get(2).toString()));
assertEquals("(rankingExpression(tan).rankingScript, x * x)",
- testRankProperties.get(3).toString());
+ testRankProperties.get(3).toString());
assertEquals("(rankingExpression(tan@).rankingScript, x * x)",
- censorBindingHash(testRankProperties.get(4).toString()));
+ censorBindingHash(testRankProperties.get(4).toString()));
assertEquals("(rankingExpression(cos).rankingScript, rankingExpression(tan@))",
- censorBindingHash(testRankProperties.get(5).toString()));
+ censorBindingHash(testRankProperties.get(5).toString()));
assertEquals("(rankingExpression(cos@).rankingScript, rankingExpression(tan@))",
censorBindingHash(testRankProperties.get(6).toString()));
assertEquals("(rankingExpression(sin).rankingScript, rankingExpression(cos@))",
- censorBindingHash(testRankProperties.get(7).toString()));
+ censorBindingHash(testRankProperties.get(7).toString()));
assertEquals("(vespa.rank.firstphase, rankingExpression(sin@))",
- censorBindingHash(testRankProperties.get(8).toString()));
+ censorBindingHash(testRankProperties.get(8).toString()));
}
@Test
- public void testFunctionShadowingArguments() throws ParseException {
+ void testFunctionShadowingArguments() throws ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(
@@ -141,15 +141,15 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase {
assertEquals("(rankingExpression(sin@).rankingScript, cos(5.0) * cos(5.0))",
censorBindingHash(testRankProperties.get(1).toString()));
assertEquals("(rankingExpression(sin).rankingScript, x * x)",
- testRankProperties.get(2).toString());
+ testRankProperties.get(2).toString());
assertEquals("(vespa.rank.firstphase, rankingExpression(firstphase))",
- censorBindingHash(testRankProperties.get(3).toString()));
+ censorBindingHash(testRankProperties.get(3).toString()));
assertEquals("(rankingExpression(firstphase).rankingScript, cos(rankingExpression(sin@)) + rankingExpression(sin@))",
- censorBindingHash(testRankProperties.get(4).toString()));
+ censorBindingHash(testRankProperties.get(4).toString()));
}
@Test
- public void testNeuralNetworkSetup() throws ParseException {
+ void testNeuralNetworkSetup() throws ParseException {
// Note: the type assigned to query profile and constant tensors here is not the correct type
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
QueryProfileRegistry queryProfiles = queryProfileWith("query(q)", "tensor(input[1])");
diff --git a/config-model/src/test/java/com/yahoo/schema/RankingExpressionValidationTestCase.java b/config-model/src/test/java/com/yahoo/schema/RankingExpressionValidationTestCase.java
index e42acee9bed..099b44bd6dd 100644
--- a/config-model/src/test/java/com/yahoo/schema/RankingExpressionValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/RankingExpressionValidationTestCase.java
@@ -4,17 +4,18 @@ package com.yahoo.schema;
import com.yahoo.schema.derived.DerivedConfiguration;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.yolean.Exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
/**
* @author bratseth
*/
public class RankingExpressionValidationTestCase extends AbstractSchemaTestCase {
@Test
- public void testInvalidExpressionProducesException() throws ParseException {
+ void testInvalidExpressionProducesException() throws ParseException {
assertFailsExpression("&/%(/%&");
assertFailsExpression("if(a==b,b)");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/ReservedWordsAsFieldNamesTestCase.java b/config-model/src/test/java/com/yahoo/schema/ReservedWordsAsFieldNamesTestCase.java
index df9d4a63650..10cb4e60e0b 100644
--- a/config-model/src/test/java/com/yahoo/schema/ReservedWordsAsFieldNamesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/ReservedWordsAsFieldNamesTestCase.java
@@ -2,11 +2,11 @@
package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author bratseth
@@ -14,7 +14,7 @@ import static org.junit.Assert.assertNotNull;
public class ReservedWordsAsFieldNamesTestCase extends AbstractSchemaTestCase {
@Test
- public void testIt() throws IOException, ParseException {
+ void testIt() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/reserved_words_as_field_names.sd");
assertNotNull(schema.getDocument().getField("inline"));
assertNotNull(schema.getDocument().getField("constants"));
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
index 929c407215a..8245119ffd7 100644
--- a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
@@ -13,17 +13,12 @@ import com.yahoo.schema.parser.ParseException;
import com.yahoo.schema.processing.MakeAliases;
import com.yahoo.vespa.documentmodel.SummaryTransform;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Iterator;
-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.*;
/**
* Tests importing of search definitions
@@ -34,7 +29,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
@Test
@SuppressWarnings("deprecation")
- public void testSimpleImporting() throws IOException, ParseException {
+ void testSimpleImporting() throws IOException, ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder sb = new ApplicationBuilder(rankProfileRegistry, new QueryProfileRegistry());
sb.addSchemaFile("src/test/examples/simple.sd");
@@ -62,7 +57,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
assertEquals("aliaz", titleAliases.next());
assertEquals("analias.totitle", titleAliases.next());
assertEquals("analias.todefault",
- schema.getIndex("default").aliasIterator().next());
+ schema.getIndex("default").aliasIterator().next());
assertEquals(RankType.IDENTITY, field.getRankType());
assertEquals(0, field.getAttributes().size());
assertNull(field.getStemming());
@@ -72,9 +67,9 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
field = (SDField) document.getField("description");
assertEquals(RankType.ABOUT, field.getRankType());
assertEquals(SummaryTransform.NONE,
- field.getSummaryField("description").getTransform());
+ field.getSummaryField("description").getTransform());
assertEquals(SummaryTransform.DYNAMICTEASER,
- field.getSummaryField("dyndesc").getTransform());
+ field.getSummaryField("dyndesc").getTransform());
assertNull(field.getStemming());
assertTrue(field.getNormalizing().doRemoveAccents());
assertEquals("hallo", schema.getIndex("description").aliasIterator().next());
@@ -94,7 +89,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
// Fifth field
field = (SDField) document.getField("popularity");
assertEquals("{ input popularity | attribute popularity; }",
- field.getIndexingScript().toString());
+ field.getIndexingScript().toString());
// Sixth field
field = (SDField) document.getField("measurement");
@@ -105,17 +100,17 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
// Seventh field
field = schema.getConcreteField("categories");
assertEquals("{ input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }",
- field.getIndexingScript().toString());
+ field.getIndexingScript().toString());
// Eight field
- field= schema.getConcreteField("categoriesagain");
+ field = schema.getConcreteField("categoriesagain");
assertEquals("{ input categoriesagain_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categoriesagain; }",
- field.getIndexingScript().toString());
+ field.getIndexingScript().toString());
// Ninth field
- field= schema.getConcreteField("exactemento");
+ field = schema.getConcreteField("exactemento");
assertEquals("{ input exactemento_src | lowercase | tokenize normalize stem:\"BEST\" | index exactemento | summary exactemento; }",
- field.getIndexingScript().toString());
+ field.getIndexingScript().toString());
// Tenth field
field = schema.getConcreteField("category_arr");
@@ -140,12 +135,12 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
assertTrue(profile.inheritedNames().isEmpty());
assertNull(profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE));
assertEquals(RankType.EMPTY,
- profile.getRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
+ profile.getRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
profile = rankProfileRegistry.get(schema, "experimental");
assertNotNull(profile);
assertEquals("default", profile.inheritedNames().get(0));
assertEquals(RankType.IDENTITY,
- profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
+ profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue());
profile = rankProfileRegistry.get(schema, "other");
assertNotNull(profile);
@@ -153,17 +148,17 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
// The extra-document field
SDField exact = schema.getConcreteField("exact");
- assertNotNull("Extra field was parsed", exact);
+ assertNotNull(exact, "Extra field was parsed");
assertEquals("exact", exact.getName());
assertEquals(Stemming.NONE, exact.getStemming());
assertFalse(exact.getNormalizing().doRemoveAccents());
assertEquals("{ input title . \" \" . input category | tokenize | summary exact | index exact; }",
- exact.getIndexingScript().toString());
+ exact.getIndexingScript().toString());
assertEquals(RankType.IDENTITY, exact.getRankType());
}
@Test
- public void testDocumentImporting() throws IOException, ParseException {
+ void testDocumentImporting() throws IOException, ParseException {
try {
// Having two documents in one sd-file is illegal.
ApplicationBuilder.buildFromFile("src/test/examples/documents.sd");
@@ -173,9 +168,9 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testIdImporting() throws IOException, ParseException {
+ void testIdImporting() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/strange.sd");
- SDField idecidemyide = (SDField)schema.getDocument().getField("idecidemyide");
+ SDField idecidemyide = (SDField) schema.getDocument().getField("idecidemyide");
assertEquals(5, idecidemyide.getId());
SDField sodoi = (SDField) schema.getDocument().getField("sodoi");
assertEquals(7, sodoi.getId());
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaParsingTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaParsingTestCase.java
index 8fe691db802..c8657df23ce 100644
--- a/config-model/src/test/java/com/yahoo/schema/SchemaParsingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SchemaParsingTestCase.java
@@ -5,9 +5,10 @@ import java.io.IOException;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Tests that search definitions are parsed correctly and that correct line number is reported in
@@ -18,23 +19,23 @@ import static org.junit.Assert.*;
public class SchemaParsingTestCase extends AbstractSchemaTestCase {
@Test
- public void requireThatIndexingExpressionsCanBeParsed() throws Exception {
+ void requireThatIndexingExpressionsCanBeParsed() throws Exception {
assertNotNull(ApplicationBuilder.buildFromFile("src/test/examples/simple.sd"));
}
@Test
- public void requireThatParseExceptionPositionIsCorrect() throws Exception {
+ void requireThatParseExceptionPositionIsCorrect() throws Exception {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_construct.sd");
} catch (ParseException e) {
- if ( ! e.getMessage().contains("at line 5, column 36.")) {
+ if (!e.getMessage().contains("at line 5, column 36.")) {
throw e;
}
}
}
@Test
- public void requireThatParserHandlesLexicalError() throws Exception {
+ void requireThatParserHandlesLexicalError() throws Exception {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_lexical_error.sd");
} catch (ParseException e) {
@@ -45,7 +46,7 @@ public class SchemaParsingTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireErrorWhenJunkAfterSearchBlock() throws IOException, ParseException {
+ void requireErrorWhenJunkAfterSearchBlock() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_junk_at_end.sd");
fail("Illegal junk at end of SD passed");
@@ -57,7 +58,7 @@ public class SchemaParsingTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireErrorWhenMissingClosingSearchBracket() throws IOException, ParseException {
+ void requireErrorWhenMissingClosingSearchBracket() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_no_closing_bracket.sd");
fail("SD without closing bracket passed");
@@ -69,12 +70,12 @@ public class SchemaParsingTestCase extends AbstractSchemaTestCase {
}
@Test
- public void illegalSearchDefinitionName() throws IOException, ParseException {
+ void illegalSearchDefinitionName() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid-name.sd");
fail("Name with dash passed");
} catch (ParseException e) {
- if ( ! e.getMessage().contains("invalid-name")) {
+ if (!e.getMessage().contains("invalid-name")) {
throw e;
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java
index 67d8ce4ff78..54e47dea6bb 100644
--- a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java
@@ -7,13 +7,10 @@ import com.yahoo.schema.processing.ImportedFieldsResolver;
import com.yahoo.schema.processing.OnnxModelTypeResolver;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.model.test.utils.DeployLoggerStub;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-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.*;
/**
* Schema tests that don't depend on files.
@@ -23,17 +20,17 @@ import static org.junit.Assert.fail;
public class SchemaTestCase {
@Test
- public void testValidationOfInheritedSchema() throws ParseException {
+ void testValidationOfInheritedSchema() throws ParseException {
try {
String schema = joinLines(
"schema test inherits nonesuch {" +
- " document test inherits nonesuch {" +
- " }" +
- "}");
+ " document test inherits nonesuch {" +
+ " }" +
+ "}");
DeployLoggerStub logger = new DeployLoggerStub();
ApplicationBuilder.createFromStrings(logger, schema);
assertEquals("schema 'test' inherits 'nonesuch', but this schema does not exist",
- logger.entries.get(0).message);
+ logger.entries.get(0).message);
fail("Expected exception");
}
catch (IllegalArgumentException e) {
@@ -42,129 +39,129 @@ public class SchemaTestCase {
}
@Test
- public void testValidationOfSchemaAndDocumentInheritanceConsistency() throws ParseException {
+ void testValidationOfSchemaAndDocumentInheritanceConsistency() throws ParseException {
try {
String parent = joinLines(
"schema parent {" +
- " document parent {" +
- " field pf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- "}");
+ " document parent {" +
+ " field pf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ "}");
String child = joinLines(
"schema child inherits parent {" +
- " document child {" +
- " field cf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- "}");
+ " document child {" +
+ " field cf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ "}");
ApplicationBuilder.createFromStrings(new DeployLoggerStub(), parent, child);
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("schema 'child' inherits 'parent', " +
- "but its document type does not inherit the parent's document type"
- , e.getMessage());
+ "but its document type does not inherit the parent's document type"
+ , e.getMessage());
}
}
@Test
- public void testSchemaInheritance() throws ParseException {
+ void testSchemaInheritance() throws ParseException {
String parentLines = joinLines(
"schema parent {" +
- " document parent {" +
- " field pf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " fieldset parent_set {" +
- " fields: pf1" +
- " }" +
- " stemming: none" +
- " index parent_index {" +
- " stemming: best" +
- " }" +
- " field parent_field type string {" +
- " indexing: input pf1 | lowercase | index | attribute | summary" +
- " }" +
- " rank-profile parent_profile {" +
- " }" +
- " constant parent_constant {" +
- " file: constants/my_constant_tensor_file.json" +
- " type: tensor<float>(x{},y{})" +
- " }" +
- " onnx-model parent_model {" +
- " file: models/my_model.onnx" +
- " }" +
- " document-summary parent_summary {" +
- " summary pf1 type string {}" +
- " }" +
- " import field parentschema_ref.name as parent_imported {}" +
- " raw-as-base64-in-summary" +
- "}");
+ " document parent {" +
+ " field pf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " fieldset parent_set {" +
+ " fields: pf1" +
+ " }" +
+ " stemming: none" +
+ " index parent_index {" +
+ " stemming: best" +
+ " }" +
+ " field parent_field type string {" +
+ " indexing: input pf1 | lowercase | index | attribute | summary" +
+ " }" +
+ " rank-profile parent_profile {" +
+ " }" +
+ " constant parent_constant {" +
+ " file: constants/my_constant_tensor_file.json" +
+ " type: tensor<float>(x{},y{})" +
+ " }" +
+ " onnx-model parent_model {" +
+ " file: models/my_model.onnx" +
+ " }" +
+ " document-summary parent_summary {" +
+ " summary pf1 type string {}" +
+ " }" +
+ " import field parentschema_ref.name as parent_imported {}" +
+ " raw-as-base64-in-summary" +
+ "}");
String child1Lines = joinLines(
"schema child1 inherits parent {" +
- " document child1 inherits parent {" +
- " field c1f1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " fieldset child1_set {" +
- " fields: c1f1, pf1" +
- " }" +
- " stemming: shortest" +
- " index child1_index {" +
- " stemming: shortest" +
- " }" +
- " field child1_field type string {" +
- " indexing: input pf1 | lowercase | index | attribute | summary" +
- " }" +
- " rank-profile child1_profile inherits parent_profile {" +
- " constants {" +
- " child1_constant tensor<float>(x{},y{}): file:constants/my_constant_tensor_file.json" +
- " }" +
- " }" +
- " onnx-model child1_model {" +
- " file: models/my_model.onnx" +
- " }" +
- " document-summary child1_summary inherits parent_summary {" +
- " summary c1f1 type string {}" +
- " }" +
- " import field parentschema_ref.name as child1_imported {}" +
- "}");
+ " document child1 inherits parent {" +
+ " field c1f1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " fieldset child1_set {" +
+ " fields: c1f1, pf1" +
+ " }" +
+ " stemming: shortest" +
+ " index child1_index {" +
+ " stemming: shortest" +
+ " }" +
+ " field child1_field type string {" +
+ " indexing: input pf1 | lowercase | index | attribute | summary" +
+ " }" +
+ " rank-profile child1_profile inherits parent_profile {" +
+ " constants {" +
+ " child1_constant tensor<float>(x{},y{}): file:constants/my_constant_tensor_file.json" +
+ " }" +
+ " }" +
+ " onnx-model child1_model {" +
+ " file: models/my_model.onnx" +
+ " }" +
+ " document-summary child1_summary inherits parent_summary {" +
+ " summary c1f1 type string {}" +
+ " }" +
+ " import field parentschema_ref.name as child1_imported {}" +
+ "}");
String child2Lines = joinLines(
"schema child2 inherits parent {" +
- " document child2 inherits parent {" +
- " field c2f1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " fieldset child2_set {" +
- " fields: c2f1, pf1" +
- " }" +
- " stemming: shortest" +
- " index child2_index {" +
- " stemming: shortest" +
- " }" +
- " field child2_field type string {" +
- " indexing: input pf1 | lowercase | index | attribute | summary" +
- " }" +
- " rank-profile child2_profile inherits parent_profile {" +
- " }" +
- " constant child2_constant {" +
- " file: constants/my_constant_tensor_file.json" +
- " type: tensor<float>(x{},y{})" +
- " }" +
- " onnx-model child2_model {" +
- " file: models/my_model.onnx" +
- " }" +
- " document-summary child2_summary inherits parent_summary {" +
- " summary c2f1 type string {}" +
- " }" +
- " import field parentschema_ref.name as child2_imported {}" +
- "}");
+ " document child2 inherits parent {" +
+ " field c2f1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " fieldset child2_set {" +
+ " fields: c2f1, pf1" +
+ " }" +
+ " stemming: shortest" +
+ " index child2_index {" +
+ " stemming: shortest" +
+ " }" +
+ " field child2_field type string {" +
+ " indexing: input pf1 | lowercase | index | attribute | summary" +
+ " }" +
+ " rank-profile child2_profile inherits parent_profile {" +
+ " }" +
+ " constant child2_constant {" +
+ " file: constants/my_constant_tensor_file.json" +
+ " type: tensor<float>(x{},y{})" +
+ " }" +
+ " onnx-model child2_model {" +
+ " file: models/my_model.onnx" +
+ " }" +
+ " document-summary child2_summary inherits parent_summary {" +
+ " summary c2f1 type string {}" +
+ " }" +
+ " import field parentschema_ref.name as child2_imported {}" +
+ "}");
ApplicationBuilder builder = new ApplicationBuilder(new DeployLoggerStub());
builder.processorsToSkip().add(OnnxModelTypeResolver.class); // Avoid discovering the Onnx model referenced does not exist
@@ -259,55 +256,55 @@ public class SchemaTestCase {
}
@Test
- public void testSchemaInheritanceEmptyChildren() throws ParseException {
+ void testSchemaInheritanceEmptyChildren() throws ParseException {
String parentLines = joinLines(
"schema parent {" +
- " document parent {" +
- " field pf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " fieldset parent_set {" +
- " fields: pf1" +
- " }" +
- " stemming: none" +
- " index parent_index {" +
- " stemming: best" +
- " }" +
- " field parent_field type string {" +
- " indexing: input pf1 | lowercase | index | attribute | summary" +
- " }" +
- " rank-profile parent_profile {" +
- " }" +
- " constant parent_constant {" +
- " file: constants/my_constant_tensor_file.json" +
- " type: tensor<float>(x{},y{})" +
- " }" +
- " onnx-model parent_model {" +
- " file: models/my_model.onnx" +
- " }" +
- " document-summary parent_summary {" +
- " summary pf1 type string {}" +
- " }" +
- " import field parentschema_ref.name as parent_imported {}" +
- " raw-as-base64-in-summary" +
- "}");
+ " document parent {" +
+ " field pf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " fieldset parent_set {" +
+ " fields: pf1" +
+ " }" +
+ " stemming: none" +
+ " index parent_index {" +
+ " stemming: best" +
+ " }" +
+ " field parent_field type string {" +
+ " indexing: input pf1 | lowercase | index | attribute | summary" +
+ " }" +
+ " rank-profile parent_profile {" +
+ " }" +
+ " constant parent_constant {" +
+ " file: constants/my_constant_tensor_file.json" +
+ " type: tensor<float>(x{},y{})" +
+ " }" +
+ " onnx-model parent_model {" +
+ " file: models/my_model.onnx" +
+ " }" +
+ " document-summary parent_summary {" +
+ " summary pf1 type string {}" +
+ " }" +
+ " import field parentschema_ref.name as parent_imported {}" +
+ " raw-as-base64-in-summary" +
+ "}");
String childLines = joinLines(
"schema child inherits parent {" +
- " document child inherits parent {" +
- " field cf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- "}");
+ " document child inherits parent {" +
+ " field cf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ "}");
String grandchildLines = joinLines(
"schema grandchild inherits child {" +
- " document grandchild inherits child {" +
- " field gf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- "}");
+ " document grandchild inherits child {" +
+ " field gf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ "}");
ApplicationBuilder builder = new ApplicationBuilder(new DeployLoggerStub());
builder.processorsToSkip().add(OnnxModelTypeResolver.class); // Avoid discovering the Onnx model referenced does not exist
@@ -323,100 +320,100 @@ public class SchemaTestCase {
}
@Test
- public void testInheritingMultipleRankProfilesWithOverlappingConstructsIsDisallowed1() throws ParseException {
+ void testInheritingMultipleRankProfilesWithOverlappingConstructsIsDisallowed1() throws ParseException {
try {
String profile = joinLines(
"schema test {" +
- " document test {" +
- " field title type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " rank-profile r1 {" +
- " first-phase {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r2 {" +
- " first-phase {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r3 inherits r1, r2 {" +
- " }" +
- "}");
+ " document test {" +
+ " field title type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " rank-profile r1 {" +
+ " first-phase {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r2 {" +
+ " first-phase {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r3 inherits r1, r2 {" +
+ " }" +
+ "}");
ApplicationBuilder.createFromStrings(new DeployLoggerStub(), profile);
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("Only one of the profiles inherited by rank profile 'r3' can contain first-phase expression, but it is present in multiple",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void testInheritingMultipleRankProfilesWithOverlappingConstructsIsAllowedWhenDefinedInChild() throws ParseException {
+ void testInheritingMultipleRankProfilesWithOverlappingConstructsIsAllowedWhenDefinedInChild() throws ParseException {
String profile = joinLines(
"schema test {" +
- " document test {" +
- " field title type string {" +
- " indexing: summary" +
- " }" +
- " field myFilter type string {" +
- " indexing: attribute\n" +
- " rank: filter" +
- " }" +
- " }" +
- " rank-profile r1 {" +
- " first-phase {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r2 {" +
- " first-phase {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r3 inherits r1, r2 {" +
- " first-phase {" + // Redefined here so this does not cause failure
- " expression: nativeRank" +
- " }" +
- " }" +
- "}");
+ " document test {" +
+ " field title type string {" +
+ " indexing: summary" +
+ " }" +
+ " field myFilter type string {" +
+ " indexing: attribute\n" +
+ " rank: filter" +
+ " }" +
+ " }" +
+ " rank-profile r1 {" +
+ " first-phase {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r2 {" +
+ " first-phase {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r3 inherits r1, r2 {" +
+ " first-phase {" + // Redefined here so this does not cause failure
+ " expression: nativeRank" +
+ " }" +
+ " }" +
+ "}");
var builder = ApplicationBuilder.createFromStrings(new DeployLoggerStub(), profile);
var r3 = builder.getRankProfileRegistry().resolve(builder.application().schemas().get("test").getDocument(), "r3");
assertEquals(1, r3.allFilterFields().size());
}
@Test
- public void testInheritingMultipleRankProfilesWithOverlappingConstructsIsDisallowed2() throws ParseException {
+ void testInheritingMultipleRankProfilesWithOverlappingConstructsIsDisallowed2() throws ParseException {
try {
String profile = joinLines(
"schema test {" +
- " document test {" +
- " field title type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " rank-profile r1 {" +
- " function f1() {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r2 {" +
- " function f1() {" +
- " expression: fieldMatch(title)" +
- " }" +
- " }" +
- " rank-profile r3 inherits r1, r2 {" +
- " }" +
- "}");
+ " document test {" +
+ " field title type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " rank-profile r1 {" +
+ " function f1() {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r2 {" +
+ " function f1() {" +
+ " expression: fieldMatch(title)" +
+ " }" +
+ " }" +
+ " rank-profile r3 inherits r1, r2 {" +
+ " }" +
+ "}");
ApplicationBuilder.createFromStrings(new DeployLoggerStub(), profile);
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("rank profile 'r3' inherits rank profile 'r2' which contains function 'f1', but this function is already defined in another profile this inherits",
- e.getMessage());
+ e.getMessage());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/StemmingSettingTestCase.java b/config-model/src/test/java/com/yahoo/schema/StemmingSettingTestCase.java
index 5dd75166783..e0f1f8dfa1c 100644
--- a/config-model/src/test/java/com/yahoo/schema/StemmingSettingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/StemmingSettingTestCase.java
@@ -4,12 +4,12 @@ package com.yahoo.schema;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.Stemming;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Stemming settings test
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertNull;
public class StemmingSettingTestCase extends AbstractSchemaTestCase {
@Test
- public void testStemmingSettings() throws IOException, ParseException {
+ void testStemmingSettings() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/stemmingsetting.sd");
SDField artist = (SDField) schema.getDocument().getField("artist");
@@ -42,7 +42,7 @@ public class StemmingSettingTestCase extends AbstractSchemaTestCase {
}
@Test
- public void requireThatStemmingIsDefaultBest() throws IOException, ParseException {
+ void requireThatStemmingIsDefaultBest() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/stemmingdefault.sd");
assertNull(schema.getConcreteField("my_str").getStemming());
assertEquals(Stemming.BEST, schema.getConcreteField("my_str").getStemming(schema));
diff --git a/config-model/src/test/java/com/yahoo/schema/StructTestCase.java b/config-model/src/test/java/com/yahoo/schema/StructTestCase.java
index b140892ed5e..087ce6ee935 100755
--- a/config-model/src/test/java/com/yahoo/schema/StructTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/StructTestCase.java
@@ -6,10 +6,12 @@ import com.yahoo.document.config.DocumenttypesConfig;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.schema.derived.Deriver;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import java.io.IOException;
-import static org.junit.Assert.fail;
+
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Tests importing of document containing array type fields
@@ -19,25 +21,25 @@ import static org.junit.Assert.fail;
public class StructTestCase extends AbstractSchemaTestCase {
@Test
- public void testStruct() throws IOException {
+ void testStruct() throws IOException {
assertConfigFile("src/test/examples/structresult.cfg",
- new DocumentmanagerConfig(Deriver.getDocumentManagerConfig("src/test/examples/struct.sd")) + "\n");
+ new DocumentmanagerConfig(Deriver.getDocumentManagerConfig("src/test/examples/struct.sd")) + "\n");
}
@Test
- public void testBadStruct() throws IOException {
+ void testBadStruct() throws IOException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/badstruct.sd");
fail("Should throw exception.");
- } catch (IllegalArgumentException|ParseException expected) {
- System.err.println("As expected, with message: "+expected.getMessage());
+ } catch (IllegalArgumentException | ParseException expected) {
+ System.err.println("As expected, with message: " + expected.getMessage());
// success
}
}
@Test
- @Ignore
- public void testStructAndDocumentWithSameNames() {
+ @Disabled
+ void testStructAndDocumentWithSameNames() {
try {
DocumenttypesConfig.Builder dt = Deriver.getDocumentTypesConfig("src/test/examples/structanddocumentwithsamenames.sd");
// while the above line may work, the config generated will fail.
@@ -51,7 +53,7 @@ public class StructTestCase extends AbstractSchemaTestCase {
* Declaring a struct before a document should work
*/
@Test
- public void testStructOutsideDocumentLegal() throws IOException, ParseException {
+ void testStructOutsideDocumentLegal() throws IOException, ParseException {
new ApplicationBuilder().addSchemaFile("src/test/examples/structoutsideofdocument.sd");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
index 0fab9b381fc..f33dc46f29b 100644
--- a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
@@ -5,7 +5,8 @@ import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.model.test.utils.DeployLoggerStub;
import com.yahoo.vespa.objects.FieldBase;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
import static com.yahoo.config.model.test.TestUtil.joinLines;
import java.util.Collection;
@@ -14,9 +15,7 @@ import java.util.Optional;
import java.util.logging.Level;
import java.util.stream.Collectors;
-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.*;
/**
* Tests summary validation
@@ -26,7 +25,7 @@ import static org.junit.Assert.fail;
public class SummaryTestCase {
@Test
- public void testMemorySummary() throws ParseException {
+ void testMemorySummary() throws ParseException {
String sd = joinLines(
"schema memorysummary {",
" document memorysummary {",
@@ -44,7 +43,7 @@ public class SummaryTestCase {
}
@Test
- public void testDiskSummary() throws ParseException {
+ void testDiskSummary() throws ParseException {
String sd = joinLines(
"schema disksummary {",
" document-summary foobar {",
@@ -65,13 +64,13 @@ public class SummaryTestCase {
assertEquals(1, logger.entries.size());
assertEquals(Level.WARNING, logger.entries.get(0).level);
assertEquals("summary field 'foo2' in document summary 'foobar' references source field 'ondisk', " +
- "which is not an attribute: Using this summary will cause disk accesses. " +
- "Set 'from-disk' on this summary class to silence this warning.",
- logger.entries.get(0).message);
+ "which is not an attribute: Using this summary will cause disk accesses. " +
+ "Set 'from-disk' on this summary class to silence this warning.",
+ logger.entries.get(0).message);
}
@Test
- public void testDiskSummaryExplicit() throws ParseException {
+ void testDiskSummaryExplicit() throws ParseException {
String sd = joinLines(
"schema disksummary {",
" document disksummary {",
@@ -94,7 +93,7 @@ public class SummaryTestCase {
}
@Test
- public void testStructMemorySummary() throws ParseException {
+ void testStructMemorySummary() throws ParseException {
String sd = joinLines(
"schema structmemorysummary {",
" document structmemorysummary {",
@@ -125,7 +124,7 @@ public class SummaryTestCase {
}
@Test
- public void testInheritance() throws Exception {
+ void testInheritance() throws Exception {
String sd = joinLines(
"schema music {",
" document music {",
@@ -174,17 +173,17 @@ public class SummaryTestCase {
);
tests.forEach(testValue -> {
var actualFields = testValue.summary.getSummaryFields().values().stream()
- .map(FieldBase::getName)
- .collect(Collectors.toList());
- assertEquals(testValue.summary.getName() + (testValue.parent == null ? " does not inherit anything" : " inherits " + testValue.parent.getName()),
- Optional.ofNullable(testValue.parent),
- testValue.summary.inherited());
- assertEquals("Summary " + testValue.summary.getName() + " has expected fields", testValue.fields, actualFields);
+ .map(FieldBase::getName)
+ .collect(Collectors.toList());
+ assertEquals(Optional.ofNullable(testValue.parent),
+ testValue.summary.inherited(),
+ testValue.summary.getName() + (testValue.parent == null ? " does not inherit anything" : " inherits " + testValue.parent.getName()));
+ assertEquals(testValue.fields, actualFields, "Summary " + testValue.summary.getName() + " has expected fields");
});
}
@Test
- public void testRedeclaringInheritedFieldFails() throws Exception {
+ void testRedeclaringInheritedFieldFails() throws Exception {
String sd = joinLines(
"schema music {",
" document music {",
@@ -212,25 +211,25 @@ public class SummaryTestCase {
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("For schema 'music', summary class 'title2', summary field 'title': Can not use " +
- "source 'title_short' for this summary field, an equally named field in summary class 'title' " +
- "uses a different source: 'title'.", e.getMessage());
+ "source 'title_short' for this summary field, an equally named field in summary class 'title' " +
+ "uses a different source: 'title'.", e.getMessage());
}
}
@Test
- public void testValidationOfInheritedSummary() throws ParseException {
+ void testValidationOfInheritedSummary() throws ParseException {
try {
String schema = joinLines(
"schema test {" +
- " document test {" +
- " }" +
- " document-summary test_summary inherits nonesuch {" +
- " }" +
- "}");
+ " document test {" +
+ " }" +
+ " document-summary test_summary inherits nonesuch {" +
+ " }" +
+ "}");
DeployLoggerStub logger = new DeployLoggerStub();
ApplicationBuilder.createFromStrings(logger, schema);
assertEquals("document summary 'test_summary' inherits nonesuch but this is not present in schema 'test'",
- logger.entries.get(0).message);
+ logger.entries.get(0).message);
// fail("Expected failure");
}
catch (IllegalArgumentException e) {
@@ -240,29 +239,29 @@ public class SummaryTestCase {
}
@Test
- public void testInheritingParentSummary() throws ParseException {
+ void testInheritingParentSummary() throws ParseException {
String parent = joinLines(
"schema parent {" +
- " document parent {" +
- " field pf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " document-summary parent_summary {" +
- " summary pf1 type string {}" +
- " }" +
- "}");
+ " document parent {" +
+ " field pf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " document-summary parent_summary {" +
+ " summary pf1 type string {}" +
+ " }" +
+ "}");
String child = joinLines(
"schema child inherits parent {" +
- " document child inherits parent {" +
- " field cf1 type string {" +
- " indexing: summary" +
- " }" +
- " }" +
- " document-summary child_summary inherits parent_summary {" +
- " summary cf1 type string {}" +
- " }" +
- "}");
+ " document child inherits parent {" +
+ " field cf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ " document-summary child_summary inherits parent_summary {" +
+ " summary cf1 type string {}" +
+ " }" +
+ "}");
DeployLoggerStub logger = new DeployLoggerStub();
ApplicationBuilder.createFromStrings(logger, parent, child);
logger.entries.forEach(e -> System.out.println(e));
diff --git a/config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java b/config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java
index 83bb0d4548c..1509ca0bf9b 100644
--- a/config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java
@@ -3,10 +3,10 @@ package com.yahoo.schema;
import com.yahoo.schema.parser.ParseException;
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.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author bratseth
@@ -14,20 +14,20 @@ import static org.junit.Assert.fail;
public class UrlFieldValidationTestCase {
@Test
- public void requireThatInheritedRiseFieldsStillCanBeInConflictButDontThrowException() throws ParseException {
+ void requireThatInheritedRiseFieldsStillCanBeInConflictButDontThrowException() throws ParseException {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema("search test {" +
- " document test { " +
- " field a type uri { indexing: attribute | summary }" +
- " }" +
- "}");
+ " document test { " +
+ " field a type uri { indexing: attribute | summary }" +
+ " }" +
+ "}");
try {
builder.build(true);
fail("Should have caused an exception");
// success
} catch (IllegalArgumentException e) {
assertEquals("Error in field 'a' in schema 'test': uri type fields cannot be attributes",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/AnnotationsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/AnnotationsTestCase.java
index 60867261f93..e17634467ac 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/AnnotationsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/AnnotationsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,47 +12,47 @@ import java.io.IOException;
public class AnnotationsTestCase extends AbstractExportingTestCase {
@Test
- public void requireThatStructRegistersIfOnlyUsedByAnnotation() throws IOException, ParseException {
+ void requireThatStructRegistersIfOnlyUsedByAnnotation() throws IOException, ParseException {
assertCorrectDeriving("annotationsstruct");
}
@Test
- public void requireThatStructRegistersIfOnlyUsedAsArrayByAnnotation() throws IOException, ParseException {
+ void requireThatStructRegistersIfOnlyUsedAsArrayByAnnotation() throws IOException, ParseException {
assertCorrectDeriving("annotationsstructarray");
}
@Test
- public void testSimpleAnnotationDeriving() throws IOException, ParseException {
+ void testSimpleAnnotationDeriving() throws IOException, ParseException {
assertCorrectDeriving("annotationssimple");
}
@Test
- public void testAnnotationDerivingWithImplicitStruct() throws IOException, ParseException {
+ void testAnnotationDerivingWithImplicitStruct() throws IOException, ParseException {
assertCorrectDeriving("annotationsimplicitstruct");
}
@Test
- public void testAnnotationDerivingInheritance() throws IOException, ParseException {
+ void testAnnotationDerivingInheritance() throws IOException, ParseException {
assertCorrectDeriving("annotationsinheritance");
}
@Test
- public void testAnnotationDerivingInheritance2() throws IOException, ParseException {
+ void testAnnotationDerivingInheritance2() throws IOException, ParseException {
assertCorrectDeriving("annotationsinheritance2");
}
@Test
- public void testSimpleReference() throws IOException, ParseException {
+ void testSimpleReference() throws IOException, ParseException {
assertCorrectDeriving("annotationsreference");
}
@Test
- public void testAdvancedReference() throws IOException, ParseException {
+ void testAdvancedReference() throws IOException, ParseException {
assertCorrectDeriving("annotationsreference2");
}
@Test
- public void testAnnotationsPolymorphy() throws IOException, ParseException {
+ void testAnnotationsPolymorphy() throws IOException, ParseException {
assertCorrectDeriving("annotationspolymorphy");
}
@@ -60,7 +60,7 @@ public class AnnotationsTestCase extends AbstractExportingTestCase {
* An annotation declared before document {} should work.
*/
@Test
- public void testAnnotationOutsideOfDocumentNew() throws IOException, ParseException {
+ void testAnnotationOutsideOfDocumentNew() throws IOException, ParseException {
assertCorrectDeriving("annotationsoutsideofdocument");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ArraysTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ArraysTestCase.java
index 5b138413a7a..a1b7e40d21b 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ArraysTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ArraysTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -16,7 +16,7 @@ import java.io.IOException;
public class ArraysTestCase extends AbstractExportingTestCase {
@Test
- public void testDocumentDeriving() throws IOException, ParseException {
+ void testDocumentDeriving() throws IOException, ParseException {
assertCorrectDeriving("arrays");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
index 1c51d3ec365..c0886597de7 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
@@ -6,14 +6,14 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.Attribute;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Iterator;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Tests attribute deriving
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertFalse;
public class AttributeListTestCase extends AbstractSchemaTestCase {
@Test
- public void testDeriving() throws IOException, ParseException {
+ void testDeriving() throws IOException, ParseException {
// Test attribute importing
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/simple.sd");
@@ -31,37 +31,37 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
AttributeFields attributeFields = new AttributeFields(schema);
Iterator attributes = attributeFields.attributeIterator();
Attribute attribute;
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("popularity", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("measurement", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("smallattribute", attribute.getName());
assertEquals(Attribute.Type.BYTE, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("access", attribute.getName());
assertEquals(Attribute.Type.BYTE, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("category_arr", attribute.getName());
assertEquals(Attribute.Type.STRING, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("measurement_arr", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.ARRAY, attribute.getCollectionType());
- attribute = (Attribute)attributes.next();
+ attribute = (Attribute) attributes.next();
assertEquals("popsiness", attribute.getName());
assertEquals(Attribute.Type.INTEGER, attribute.getType());
assertEquals(Attribute.CollectionType.SINGLE, attribute.getCollectionType());
@@ -70,7 +70,7 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
}
@Test
- public void fields_in_array_of_struct_are_derived_into_array_attributes() throws IOException, ParseException {
+ void fields_in_array_of_struct_are_derived_into_array_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/array_of_struct_attribute/test.sd");
Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator();
@@ -80,7 +80,7 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
}
@Test
- public void fields_in_map_of_struct_are_derived_into_array_attributes() throws IOException, ParseException {
+ void fields_in_map_of_struct_are_derived_into_array_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd");
Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator();
@@ -100,15 +100,15 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
}
@Test
- public void only_zcurve_attribute_is_derived_from_array_of_position_field() throws ParseException {
+ void only_zcurve_attribute_is_derived_from_array_of_position_field() throws ParseException {
Schema schema = ApplicationBuilder.createFromString(
joinLines("search test {",
- " document test {",
- " field pos_array type array<position> {",
- " indexing: attribute",
- " }",
- " }",
- "}")).getSchema();
+ " document test {",
+ " field pos_array type array<position> {",
+ " indexing: attribute",
+ " }",
+ " }",
+ "}")).getSchema();
Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator();
assertAttribute("pos_array_zcurve", Attribute.Type.LONG, Attribute.CollectionType.ARRAY, true, attributes.next());
@@ -116,7 +116,7 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
}
@Test
- public void fields_in_map_of_primitive_are_derived_into_array_attributes() throws IOException, ParseException {
+ void fields_in_map_of_primitive_are_derived_into_array_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/map_attribute/test.sd");
Iterator<Attribute> attributes = new AttributeFields(schema).attributeIterator();
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/AttributesTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/AttributesTestCase.java
index 3d08805acdf..f8b66c8f41b 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/AttributesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/AttributesTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,22 +14,22 @@ import java.io.IOException;
public class AttributesTestCase extends AbstractExportingTestCase {
@Test
- public void testDocumentDeriving() throws IOException, ParseException {
+ void testDocumentDeriving() throws IOException, ParseException {
assertCorrectDeriving("attributes");
}
@Test
- public void testArrayOfStructAttribute() throws IOException, ParseException {
+ void testArrayOfStructAttribute() throws IOException, ParseException {
assertCorrectDeriving("array_of_struct_attribute");
}
@Test
- public void testMapOfStructAttribute() throws IOException, ParseException {
+ void testMapOfStructAttribute() throws IOException, ParseException {
assertCorrectDeriving("map_of_struct_attribute");
}
@Test
- public void testMapOfPrimitiveAttribute() throws IOException, ParseException {
+ void testMapOfPrimitiveAttribute() throws IOException, ParseException {
assertCorrectDeriving("map_attribute");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/CasingTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/CasingTestCase.java
index 80ebcb825f4..1ee0aa76126 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/CasingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/CasingTestCase.java
@@ -5,11 +5,11 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Correct casing for derived attributes
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
public class CasingTestCase extends AbstractSchemaTestCase {
@Test
- public void testCasing() throws IOException, ParseException {
+ void testCasing() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/casing.sd");
assertEquals(schema.getIndex("color").getName(), "color");
assertEquals(schema.getIndex("Foo").getName(), "Foo");
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/CombinedAttributeAndIndexSchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/CombinedAttributeAndIndexSchemaTestCase.java
index 542320d9670..3e984ade647 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/CombinedAttributeAndIndexSchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/CombinedAttributeAndIndexSchemaTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,7 +14,7 @@ import java.io.IOException;
public class CombinedAttributeAndIndexSchemaTestCase extends AbstractExportingTestCase {
@Test
- public void testMultipleSummaries() throws IOException, ParseException {
+ void testMultipleSummaries() throws IOException, ParseException {
assertCorrectDeriving("combinedattributeandindexsearch");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/DeriverTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/DeriverTestCase.java
index 422f4522b26..55767e8f8c0 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/DeriverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/DeriverTestCase.java
@@ -5,11 +5,11 @@ import com.yahoo.document.DataType;
import com.yahoo.document.DocumentTypeManager;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.schema.AbstractSchemaTestCase;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests deriving using the Deriver facade
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
public class DeriverTestCase extends AbstractSchemaTestCase {
@Test
- public void testDeriveDocManager() {
+ void testDeriveDocManager() {
DocumentTypeManager dtm = new DocumentTypeManager(new DocumentmanagerConfig(
Deriver.getDocumentManagerConfig(List.of(
"src/test/derived/deriver/child.sd",
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/DuplicateStructTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/DuplicateStructTestCase.java
index 7915a1d7763..7287de68f2f 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/DuplicateStructTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/DuplicateStructTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* @author arnej
@@ -10,10 +10,10 @@ import org.junit.Test;
public class DuplicateStructTestCase extends AbstractExportingTestCase {
@Test
- public void exact_duplicate_struct_works() throws Exception {
+ void exact_duplicate_struct_works() throws Exception {
assertCorrectDeriving("duplicate_struct", "foobar",
- new TestProperties(),
- new TestableDeployLogger());
+ new TestProperties(),
+ new TestableDeployLogger());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/EmptyRankProfileTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/EmptyRankProfileTestCase.java
index c3195d1a626..a1df845c97d 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/EmptyRankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/EmptyRankProfileTestCase.java
@@ -10,7 +10,7 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests deriving rank for files from search definitions
@@ -20,7 +20,7 @@ import org.junit.Test;
public class EmptyRankProfileTestCase extends AbstractSchemaTestCase {
@Test
- public void testDeriving() {
+ void testDeriving() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType doc = new SDDocumentType("test");
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ExactMatchTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ExactMatchTestCase.java
index 13a0a8201fb..6b7e8bb714d 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ExactMatchTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ExactMatchTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -11,7 +11,7 @@ import java.io.IOException;
*/
public class ExactMatchTestCase extends AbstractExportingTestCase {
@Test
- public void testExactString() throws IOException, ParseException {
+ void testExactString() throws IOException, ParseException {
assertCorrectDeriving("exactmatch");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ExportingTestCase.java
index dc10004a631..b5b075ae260 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ExportingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ExportingTestCase.java
@@ -4,11 +4,11 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests exporting
@@ -18,144 +18,144 @@ import static org.junit.Assert.assertEquals;
public class ExportingTestCase extends AbstractExportingTestCase {
@Test
- public void testIndexInfoLowerCase() throws IOException, ParseException {
+ void testIndexInfoLowerCase() throws IOException, ParseException {
assertCorrectDeriving("indexinfo_lowercase");
}
@Test
- public void testPositionArray() throws IOException, ParseException {
+ void testPositionArray() throws IOException, ParseException {
assertCorrectDeriving("position_array",
- new TestProperties().setUseV8GeoPositions(true));
+ new TestProperties().setUseV8GeoPositions(true));
}
@Test
- public void testPositionAttribute() throws IOException, ParseException {
+ void testPositionAttribute() throws IOException, ParseException {
assertCorrectDeriving("position_attribute",
- new TestProperties().setUseV8GeoPositions(true));
+ new TestProperties().setUseV8GeoPositions(true));
}
@Test
- public void testPositionExtra() throws IOException, ParseException {
+ void testPositionExtra() throws IOException, ParseException {
assertCorrectDeriving("position_extra",
- new TestProperties().setUseV8GeoPositions(true));
+ new TestProperties().setUseV8GeoPositions(true));
}
@Test
- public void testPositionNoSummary() throws IOException, ParseException {
+ void testPositionNoSummary() throws IOException, ParseException {
assertCorrectDeriving("position_nosummary",
- new TestProperties().setUseV8GeoPositions(true));
+ new TestProperties().setUseV8GeoPositions(true));
}
@Test
- public void testPositionSummary() throws IOException, ParseException {
+ void testPositionSummary() throws IOException, ParseException {
assertCorrectDeriving("position_summary",
- new TestProperties().setUseV8GeoPositions(true));
+ new TestProperties().setUseV8GeoPositions(true));
}
@Test
- public void testUriArray() throws IOException, ParseException {
+ void testUriArray() throws IOException, ParseException {
assertCorrectDeriving("uri_array");
}
@Test
- public void testUriWSet() throws IOException, ParseException {
+ void testUriWSet() throws IOException, ParseException {
assertCorrectDeriving("uri_wset");
}
@Test
- public void testMusic() throws IOException, ParseException {
+ void testMusic() throws IOException, ParseException {
assertCorrectDeriving("music");
}
@Test
- public void testComplexPhysicalExporting() throws IOException, ParseException {
+ void testComplexPhysicalExporting() throws IOException, ParseException {
assertCorrectDeriving("complex");
}
@Test
- public void testAttributePrefetch() throws IOException, ParseException {
+ void testAttributePrefetch() throws IOException, ParseException {
assertCorrectDeriving("attributeprefetch");
}
@Test
- public void testAdvancedIL() throws IOException, ParseException {
+ void testAdvancedIL() throws IOException, ParseException {
assertCorrectDeriving("advanced");
}
@Test
- public void testEmptyDefaultIndex() throws IOException, ParseException {
+ void testEmptyDefaultIndex() throws IOException, ParseException {
assertCorrectDeriving("emptydefault");
}
@Test
- public void testIndexSwitches() throws IOException, ParseException {
+ void testIndexSwitches() throws IOException, ParseException {
assertCorrectDeriving("indexswitches");
}
@Test
- public void testRankTypes() throws IOException, ParseException {
+ void testRankTypes() throws IOException, ParseException {
assertCorrectDeriving("ranktypes");
}
@Test
- public void testAttributeRank() throws IOException, ParseException {
+ void testAttributeRank() throws IOException, ParseException {
assertCorrectDeriving("attributerank");
}
@Test
- public void testNewRank() throws IOException, ParseException {
+ void testNewRank() throws IOException, ParseException {
assertCorrectDeriving("newrank");
}
@Test
- public void testRankingExpression() throws IOException, ParseException {
+ void testRankingExpression() throws IOException, ParseException {
assertCorrectDeriving("rankingexpression");
}
@Test
- public void testAvoidRenamingRankingExpression() throws IOException, ParseException {
+ void testAvoidRenamingRankingExpression() throws IOException, ParseException {
assertCorrectDeriving("renamedfeatures", "foo",
- new TestProperties(),
- new TestableDeployLogger());
+ new TestProperties(),
+ new TestableDeployLogger());
}
@Test
- public void testMlr() throws IOException, ParseException {
+ void testMlr() throws IOException, ParseException {
assertCorrectDeriving("mlr");
}
@Test
- public void testMusic3() throws IOException, ParseException {
+ void testMusic3() throws IOException, ParseException {
assertCorrectDeriving("music3");
}
@Test
- public void testIndexSchema() throws IOException, ParseException {
+ void testIndexSchema() throws IOException, ParseException {
assertCorrectDeriving("indexschema");
}
@Test
- public void testIndexinfoFieldsets() throws IOException, ParseException {
+ void testIndexinfoFieldsets() throws IOException, ParseException {
assertCorrectDeriving("indexinfo_fieldsets");
}
@Test
- public void testStreamingJuniper() throws IOException, ParseException {
+ void testStreamingJuniper() throws IOException, ParseException {
assertCorrectDeriving("streamingjuniper");
}
@Test
- public void testPredicateAttribute() throws IOException, ParseException {
+ void testPredicateAttribute() throws IOException, ParseException {
assertCorrectDeriving("predicate_attribute");
}
@Test
- public void testTensor() throws IOException, ParseException {
+ void testTensor() throws IOException, ParseException {
assertCorrectDeriving("tensor");
}
@Test
- public void testTensor2() throws IOException, ParseException {
+ void testTensor2() throws IOException, ParseException {
String dir = "src/test/derived/tensor2/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "first.sd");
@@ -166,29 +166,29 @@ public class ExportingTestCase extends AbstractExportingTestCase {
}
@Test
- public void testHnswIndex() throws IOException, ParseException {
+ void testHnswIndex() throws IOException, ParseException {
assertCorrectDeriving("hnsw_index");
}
@Test
- public void testRankProfileInheritance() throws IOException, ParseException {
+ void testRankProfileInheritance() throws IOException, ParseException {
assertCorrectDeriving("rankprofileinheritance", "child", new TestableDeployLogger());
}
@Test
- public void testLanguage() throws IOException, ParseException {
+ void testLanguage() throws IOException, ParseException {
TestableDeployLogger logger = new TestableDeployLogger();
assertCorrectDeriving("language", logger);
assertEquals(0, logger.warnings.size());
}
@Test
- public void testRankProfileModularity() throws IOException, ParseException {
+ void testRankProfileModularity() throws IOException, ParseException {
assertCorrectDeriving("rankprofilemodularity");
}
@Test
- public void testStructAndFieldSet() throws IOException, ParseException {
+ void testStructAndFieldSet() throws IOException, ParseException {
assertCorrectDeriving("structandfieldset");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ExpressionsAsArgsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ExpressionsAsArgsTestCase.java
index d2020305bc1..31dfd240538 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ExpressionsAsArgsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ExpressionsAsArgsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,7 +14,7 @@ import java.io.IOException;
public class ExpressionsAsArgsTestCase extends AbstractExportingTestCase {
@Test
- public void testDocumentDeriving() throws IOException, ParseException {
+ void testDocumentDeriving() throws IOException, ParseException {
assertCorrectDeriving("function_arguments");
assertCorrectDeriving("function_arguments_with_expressions");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/FieldsetTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/FieldsetTestCase.java
index fdab49c9fff..c223152e3da 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/FieldsetTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/FieldsetTestCase.java
@@ -2,14 +2,14 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
public class FieldsetTestCase extends AbstractExportingTestCase {
@Test
- public void testRankProfiles() throws IOException, ParseException {
+ void testRankProfiles() throws IOException, ParseException {
assertCorrectDeriving("fieldset");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/GeminiTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/GeminiTestCase.java
index 5531fb65942..3a809d190bc 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/GeminiTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/GeminiTestCase.java
@@ -3,21 +3,22 @@ package com.yahoo.schema.derived;
import com.yahoo.collections.Pair;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
/**
* @author bratseth
*/
public class GeminiTestCase extends AbstractExportingTestCase {
@Test
- public void testRanking2() throws IOException, ParseException {
+ void testRanking2() throws IOException, ParseException {
DerivedConfiguration c = assertCorrectDeriving("gemini2");
RawRankProfile p = c.getRankProfileList().getRankProfiles().get("test");
Map<String, String> ranking = removePartKeySuffixes(asMap(p.configProperties()));
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
index 1e57d52e3b0..f2614e9e85b 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
@@ -10,12 +10,12 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
-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;
/**
* Tests that documents ids are treated as they should
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertNull;
public class IdTestCase extends AbstractExportingTestCase {
@Test
- public void testExplicitUpperCaseIdField() {
+ void testExplicitUpperCaseIdField() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty());
SDDocumentType document = new SDDocumentType("test");
schema.addDocument(document);
@@ -34,7 +34,7 @@ public class IdTestCase extends AbstractExportingTestCase {
document.addField(uri);
new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(),
- true, false, Set.of());
+ true, false, Set.of());
assertNull(document.getField("uri"));
assertNull(document.getField("Uri"));
@@ -42,7 +42,7 @@ public class IdTestCase extends AbstractExportingTestCase {
}
@Test
- public void testCompleteDeriving() throws Exception {
+ void testCompleteDeriving() throws Exception {
assertCorrectDeriving("id");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ImportedFieldsTestCase.java
index 5578a1a602b..fb87137cc2e 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ImportedFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ImportedFieldsTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -13,29 +13,29 @@ import java.io.IOException;
public class ImportedFieldsTestCase extends AbstractExportingTestCase {
@Test
- public void configs_for_imported_fields_are_derived() throws IOException, ParseException {
+ void configs_for_imported_fields_are_derived() throws IOException, ParseException {
assertCorrectDeriving("importedfields", "child", new TestableDeployLogger());
}
@Test
- public void configs_for_imported_struct_fields_are_derived() throws IOException, ParseException {
+ void configs_for_imported_struct_fields_are_derived() throws IOException, ParseException {
assertCorrectDeriving("imported_struct_fields", "child",
- new TestProperties(),
- new TestableDeployLogger());
+ new TestProperties(),
+ new TestableDeployLogger());
}
@Test
- public void configs_for_imported_position_field_are_derived() throws IOException, ParseException {
+ void configs_for_imported_position_field_are_derived() throws IOException, ParseException {
assertCorrectDeriving("imported_position_field", "child", new TestableDeployLogger());
}
@Test
- public void configs_for_imported_position_field_summary_are_derived() throws IOException, ParseException {
+ void configs_for_imported_position_field_summary_are_derived() throws IOException, ParseException {
assertCorrectDeriving("imported_position_field_summary", "child", new TestableDeployLogger());
}
@Test
- public void derives_configs_for_imported_fields_when_reference_fields_are_inherited() throws IOException, ParseException {
+ void derives_configs_for_imported_fields_when_reference_fields_are_inherited() throws IOException, ParseException {
assertCorrectDeriving("imported_fields_inherited_reference", "child_c", new TestableDeployLogger());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
index 1f40c6bcb50..39d436f6676 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
@@ -4,15 +4,15 @@ package com.yahoo.schema.derived;
import com.yahoo.document.DataType;
import com.yahoo.document.Field;
import com.yahoo.document.StructDataType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -20,7 +20,7 @@ import static org.junit.Assert.fail;
public class IndexSchemaTestCase {
@Test
- public void requireThatPrimitiveIsNotFlattened() {
+ void requireThatPrimitiveIsNotFlattened() {
assertFlat(new Field("foo", DataType.BYTE), new Field("foo", DataType.BYTE));
assertFlat(new Field("foo", DataType.DOUBLE), new Field("foo", DataType.DOUBLE));
assertFlat(new Field("foo", DataType.FLOAT), new Field("foo", DataType.FLOAT));
@@ -33,29 +33,29 @@ public class IndexSchemaTestCase {
}
@Test
- public void requireThatArrayOfPrimitiveIsNotFlattened() {
+ void requireThatArrayOfPrimitiveIsNotFlattened() {
assertFlat(new Field("foo", DataType.getArray(DataType.BYTE)),
- new Field("foo", DataType.getArray(DataType.BYTE)));
+ new Field("foo", DataType.getArray(DataType.BYTE)));
assertFlat(new Field("foo", DataType.getArray(DataType.DOUBLE)),
- new Field("foo", DataType.getArray(DataType.DOUBLE)));
+ new Field("foo", DataType.getArray(DataType.DOUBLE)));
assertFlat(new Field("foo", DataType.getArray(DataType.FLOAT)),
- new Field("foo", DataType.getArray(DataType.FLOAT)));
+ new Field("foo", DataType.getArray(DataType.FLOAT)));
assertFlat(new Field("foo", DataType.getArray(DataType.INT)),
- new Field("foo", DataType.getArray(DataType.INT)));
+ new Field("foo", DataType.getArray(DataType.INT)));
assertFlat(new Field("foo", DataType.getArray(DataType.LONG)),
- new Field("foo", DataType.getArray(DataType.LONG)));
+ new Field("foo", DataType.getArray(DataType.LONG)));
assertFlat(new Field("foo", DataType.getArray(DataType.RAW)),
- new Field("foo", DataType.getArray(DataType.RAW)));
+ new Field("foo", DataType.getArray(DataType.RAW)));
assertFlat(new Field("foo", DataType.getArray(DataType.STRING)),
- new Field("foo", DataType.getArray(DataType.STRING)));
+ new Field("foo", DataType.getArray(DataType.STRING)));
assertFlat(new Field("foo", DataType.getArray(DataType.URI)),
- new Field("foo", DataType.getArray(DataType.URI)));
+ new Field("foo", DataType.getArray(DataType.URI)));
assertFlat(new Field("foo", DataType.getArray(DataType.PREDICATE)),
- new Field("foo", DataType.getArray(DataType.PREDICATE)));
+ new Field("foo", DataType.getArray(DataType.PREDICATE)));
}
@Test
- public void requireThatStructIsFlattened() {
+ void requireThatStructIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.BYTE));
type.addField(new Field("my_double", DataType.DOUBLE));
@@ -67,18 +67,18 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.URI));
assertFlat(new Field("foo", type),
- new Field("foo.my_byte", DataType.BYTE),
- new Field("foo.my_double", DataType.DOUBLE),
- new Field("foo.my_float", DataType.FLOAT),
- new Field("foo.my_int", DataType.INT),
- new Field("foo.my_long", DataType.LONG),
- new Field("foo.my_raw", DataType.RAW),
- new Field("foo.my_string", DataType.STRING),
- new Field("foo.my_uri", DataType.URI));
+ new Field("foo.my_byte", DataType.BYTE),
+ new Field("foo.my_double", DataType.DOUBLE),
+ new Field("foo.my_float", DataType.FLOAT),
+ new Field("foo.my_int", DataType.INT),
+ new Field("foo.my_long", DataType.LONG),
+ new Field("foo.my_raw", DataType.RAW),
+ new Field("foo.my_string", DataType.STRING),
+ new Field("foo.my_uri", DataType.URI));
}
@Test
- public void requireThatArrayOfStructIsFlattened() {
+ void requireThatArrayOfStructIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.BYTE));
type.addField(new Field("my_double", DataType.DOUBLE));
@@ -90,18 +90,18 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.URI));
assertFlat(new Field("foo", DataType.getArray(type)),
- new Field("foo.my_byte", DataType.getArray(DataType.BYTE)),
- new Field("foo.my_double", DataType.getArray(DataType.DOUBLE)),
- new Field("foo.my_float", DataType.getArray(DataType.FLOAT)),
- new Field("foo.my_int", DataType.getArray(DataType.INT)),
- new Field("foo.my_long", DataType.getArray(DataType.LONG)),
- new Field("foo.my_raw", DataType.getArray(DataType.RAW)),
- new Field("foo.my_string", DataType.getArray(DataType.STRING)),
- new Field("foo.my_uri", DataType.getArray(DataType.URI)));
+ new Field("foo.my_byte", DataType.getArray(DataType.BYTE)),
+ new Field("foo.my_double", DataType.getArray(DataType.DOUBLE)),
+ new Field("foo.my_float", DataType.getArray(DataType.FLOAT)),
+ new Field("foo.my_int", DataType.getArray(DataType.INT)),
+ new Field("foo.my_long", DataType.getArray(DataType.LONG)),
+ new Field("foo.my_raw", DataType.getArray(DataType.RAW)),
+ new Field("foo.my_string", DataType.getArray(DataType.STRING)),
+ new Field("foo.my_uri", DataType.getArray(DataType.URI)));
}
@Test
- public void requireThatArrayOfArrayOfStructIsFlattened() {
+ void requireThatArrayOfArrayOfStructIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.BYTE));
type.addField(new Field("my_double", DataType.DOUBLE));
@@ -113,18 +113,18 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.URI));
assertFlat(new Field("foo", DataType.getArray(DataType.getArray(type))),
- new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
- new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
- new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
- new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
- new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
- new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
- new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
- new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
+ new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
+ new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
+ new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
+ new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
+ new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
+ new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
+ new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
+ new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
}
@Test
- public void requireThatStructWithArrayFieldIsFlattened() {
+ void requireThatStructWithArrayFieldIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.getArray(DataType.BYTE)));
type.addField(new Field("my_double", DataType.getArray(DataType.DOUBLE)));
@@ -136,18 +136,18 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.getArray(DataType.URI)));
assertFlat(new Field("foo", type),
- new Field("foo.my_byte", DataType.getArray(DataType.BYTE)),
- new Field("foo.my_double", DataType.getArray(DataType.DOUBLE)),
- new Field("foo.my_float", DataType.getArray(DataType.FLOAT)),
- new Field("foo.my_int", DataType.getArray(DataType.INT)),
- new Field("foo.my_long", DataType.getArray(DataType.LONG)),
- new Field("foo.my_raw", DataType.getArray(DataType.RAW)),
- new Field("foo.my_string", DataType.getArray(DataType.STRING)),
- new Field("foo.my_uri", DataType.getArray(DataType.URI)));
+ new Field("foo.my_byte", DataType.getArray(DataType.BYTE)),
+ new Field("foo.my_double", DataType.getArray(DataType.DOUBLE)),
+ new Field("foo.my_float", DataType.getArray(DataType.FLOAT)),
+ new Field("foo.my_int", DataType.getArray(DataType.INT)),
+ new Field("foo.my_long", DataType.getArray(DataType.LONG)),
+ new Field("foo.my_raw", DataType.getArray(DataType.RAW)),
+ new Field("foo.my_string", DataType.getArray(DataType.STRING)),
+ new Field("foo.my_uri", DataType.getArray(DataType.URI)));
}
@Test
- public void requireThatStructWithArrayOfArrayFieldIsFlattened() {
+ void requireThatStructWithArrayOfArrayFieldIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))));
type.addField(new Field("my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))));
@@ -159,18 +159,18 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
assertFlat(new Field("foo", type),
- new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
- new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
- new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
- new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
- new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
- new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
- new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
- new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
+ new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
+ new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
+ new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
+ new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
+ new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
+ new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
+ new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
+ new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
}
@Test
- public void requireThatArrayOfStructWithArrayFieldIsFlattened() {
+ void requireThatArrayOfStructWithArrayFieldIsFlattened() {
StructDataType type = new StructDataType("my_struct");
type.addField(new Field("my_byte", DataType.getArray(DataType.BYTE)));
type.addField(new Field("my_double", DataType.getArray(DataType.DOUBLE)));
@@ -182,14 +182,14 @@ public class IndexSchemaTestCase {
type.addField(new Field("my_uri", DataType.getArray(DataType.URI)));
assertFlat(new Field("foo", DataType.getArray(type)),
- new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
- new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
- new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
- new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
- new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
- new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
- new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
- new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
+ new Field("foo.my_byte", DataType.getArray(DataType.getArray(DataType.BYTE))),
+ new Field("foo.my_double", DataType.getArray(DataType.getArray(DataType.DOUBLE))),
+ new Field("foo.my_float", DataType.getArray(DataType.getArray(DataType.FLOAT))),
+ new Field("foo.my_int", DataType.getArray(DataType.getArray(DataType.INT))),
+ new Field("foo.my_long", DataType.getArray(DataType.getArray(DataType.LONG))),
+ new Field("foo.my_raw", DataType.getArray(DataType.getArray(DataType.RAW))),
+ new Field("foo.my_string", DataType.getArray(DataType.getArray(DataType.STRING))),
+ new Field("foo.my_uri", DataType.getArray(DataType.getArray(DataType.URI))));
}
private static void assertFlat(Field fieldToFlatten, Field... expectedFields) {
@@ -202,7 +202,7 @@ public class IndexSchemaTestCase {
fail("Unexpected field: " + field);
}
}
- assertTrue("Missing fields: " + expected, expected.isEmpty());
+ assertTrue(expected.isEmpty(), "Missing fields: " + expected);
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
index 1c433237fd8..66833233341 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
@@ -12,19 +12,15 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.configmodel.producers.DocumentManager;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
-import org.junit.rules.TemporaryFolder;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Tests inheritance
@@ -33,11 +29,11 @@ import static org.junit.Assert.assertNull;
*/
public class InheritanceTestCase extends AbstractExportingTestCase {
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
+ @TempDir
+ public File tmpDir;
@Test
- public void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException {
+ void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException {
String dir = "src/test/derived/inheritstruct/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "parent.sd");
@@ -48,7 +44,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void requireThatInheritFromNullIsCaught() throws IOException, ParseException {
+ void requireThatInheritFromNullIsCaught() throws IOException, ParseException {
try {
assertCorrectDeriving("inheritfromnull");
} catch (IllegalArgumentException e) {
@@ -57,7 +53,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException {
+ void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException {
String dir = "src/test/derived/inheritdiamond/";
{
ApplicationBuilder builder = new ApplicationBuilder();
@@ -70,7 +66,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
assertCorrectConfigFiles("inheritdiamond");
}
List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd");
- File outDir = tmpDir.newFolder("out");
+ File outDir = newFolder(tmpDir, "out");
for (int startIdx = 0; startIdx < files.size(); ++startIdx) {
var builder = new ApplicationBuilder(new TestProperties());
for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) {
@@ -80,7 +76,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
builder.build(true);
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
DerivedConfiguration.exportDocuments(new DocumentManager().
- produce(builder.getModel(), b), outDir.getPath());
+ produce(builder.getModel(), b), outDir.getPath());
DocumentmanagerConfig dc = b.build();
assertEquals(5, dc.doctype().size());
@@ -120,9 +116,9 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
return null;
}
-
+
@Test
- public void requireThatStructTypesAreInheritedFromParent() throws IOException, ParseException {
+ void requireThatStructTypesAreInheritedFromParent() throws IOException, ParseException {
String dir = "src/test/derived/inheritfromparent/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "parent.sd");
@@ -133,7 +129,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void requireThatStructTypesAreInheritedFromGrandParent() throws IOException, ParseException {
+ void requireThatStructTypesAreInheritedFromGrandParent() throws IOException, ParseException {
String dir = "src/test/derived/inheritfromgrandparent/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "grandparent.sd");
@@ -145,7 +141,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void testInheritance() throws IOException, ParseException {
+ void testInheritance() throws IOException, ParseException {
String dir = "src/test/derived/inheritance/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "grandparent.sd");
@@ -158,7 +154,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void testIndexSettingInheritance() {
+ void testIndexSettingInheritance() {
SDDocumentType parent = new SDDocumentType("parent");
Schema parentSchema = new Schema("parent", MockApplicationPackage.createEmpty());
parentSchema.addDocument(parent);
@@ -171,13 +167,13 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
Schema childSchema = new Schema("child", MockApplicationPackage.createEmpty());
childSchema.addDocument(child);
- prefixed = (SDField)child.getField("prefixed");
+ prefixed = (SDField) child.getField("prefixed");
assertNotNull(prefixed);
assertEquals(new Index("prefixed", true), childSchema.getIndex("prefixed"));
}
@Test
- public void testInheritStructDiamondNew() throws IOException, ParseException {
+ void testInheritStructDiamondNew() throws IOException, ParseException {
String dir = "src/test/derived/declstruct/";
List<String> files = Arrays.asList("common.sd", "foo.sd", "bar.sd", "foobar.sd");
var builder = new ApplicationBuilder(new TestProperties());
@@ -189,4 +185,13 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
assertCorrectConfigFiles("declstruct");
}
+ private static File newFolder(File root, String... subDirs) throws IOException {
+ String subFolder = String.join("/", subDirs);
+ File result = new File(root, subFolder);
+ if (!result.mkdirs()) {
+ throw new IOException("Couldn't create folders " + root);
+ }
+ return result;
+ }
+
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IntegerAttributeToStringIndexTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IntegerAttributeToStringIndexTestCase.java
index b5f222673ab..8a77bd714fd 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/IntegerAttributeToStringIndexTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/IntegerAttributeToStringIndexTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -11,7 +11,7 @@ import java.io.IOException;
*/
public class IntegerAttributeToStringIndexTestCase extends AbstractExportingTestCase {
@Test
- public void testIt() throws IOException, ParseException {
+ void testIt() throws IOException, ParseException {
assertCorrectDeriving("integerattributetostringindex");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
index c5090c88a1b..c32f5f2b3a4 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
@@ -13,13 +13,13 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Set;
import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author bratseth
@@ -30,7 +30,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
* Tests adding of literal boost constructs
*/
@Test
- public void testLiteralBoost() {
+ void testLiteralBoost() {
Schema schema = new Schema("literalboost", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType document = new SDDocumentType("literalboost");
@@ -43,7 +43,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
other.addRankSetting(new RankProfile.RankSetting("a", RankProfile.RankSetting.Type.LITERALBOOST, 333));
new Processing().process(schema, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(),
- true, false, Set.of());
+ true, false, Set.of());
DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry);
// Check attribute fields
@@ -51,8 +51,8 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
// Check il script addition
assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
- "clear_state | guard { input a | tokenize | index a_literal; }"),
- schema);
+ "clear_state | guard { input a | tokenize | index a_literal; }"),
+ schema);
// Check index info addition
IndexInfo indexInfo = derived.getIndexInfo();
@@ -63,7 +63,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
* Tests adding a literal boost in a non-default rank profile only
*/
@Test
- public void testNonDefaultRankLiteralBoost() {
+ void testNonDefaultRankLiteralBoost() {
Schema schema = new Schema("literalboost", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType document = new SDDocumentType("literalboost");
@@ -79,17 +79,17 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
// Check il script addition
assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
- "clear_state | guard { input a | tokenize | index a_literal; }"),
- schema);
+ "clear_state | guard { input a | tokenize | index a_literal; }"),
+ schema);
// Check index info addition
IndexInfo indexInfo = derived.getIndexInfo();
- assertTrue(indexInfo.hasCommand("a","literal-boost"));
+ assertTrue(indexInfo.hasCommand("a", "literal-boost"));
}
/** Tests literal boosts in two fields going to the same index */
@Test
- public void testTwoLiteralBoostFields() {
+ void testTwoLiteralBoostFields() {
Schema schema = new Schema("msb", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType document = new SDDocumentType("msb");
@@ -104,10 +104,10 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
schema = ApplicationBuilder.buildFromRawSchema(schema, rankProfileRegistry, new QueryProfileRegistry());
new DerivedConfiguration(schema, rankProfileRegistry);
assertIndexing(Arrays.asList("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }",
- "clear_state | guard { input body | tokenize normalize stem:\"BEST\" | summary body | index body; }",
- "clear_state | guard { input title | tokenize | index title_literal; }",
- "clear_state | guard { input body | tokenize | index body_literal; }"),
- schema);
+ "clear_state | guard { input body | tokenize normalize stem:\"BEST\" | summary body | index body; }",
+ "clear_state | guard { input title | tokenize | index title_literal; }",
+ "clear_state | guard { input body | tokenize | index body_literal; }"),
+ schema);
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/LowercaseTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/LowercaseTestCase.java
index f234a9cc324..198de997f94 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/LowercaseTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/LowercaseTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,7 +12,7 @@ import java.io.IOException;
public class LowercaseTestCase extends AbstractExportingTestCase {
@Test
- public void testDeriving() throws IOException, ParseException {
+ void testDeriving() throws IOException, ParseException {
assertCorrectDeriving("lowercase");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/MailTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/MailTestCase.java
index c48c44554ed..48aca401694 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/MailTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/MailTestCase.java
@@ -3,7 +3,8 @@ package com.yahoo.schema.derived;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
import java.io.IOException;
/**
@@ -14,7 +15,7 @@ import java.io.IOException;
public class MailTestCase extends AbstractExportingTestCase {
@Test
- public void testMail() throws IOException, ParseException {
+ void testMail() throws IOException, ParseException {
String dir = "src/test/derived/mail/";
ApplicationBuilder sb = new ApplicationBuilder();
sb.addSchemaFile(dir + "mail.sd");
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/MatchSettingsResolvingTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/MatchSettingsResolvingTestCase.java
index a7df862134a..ea79766ed8a 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/MatchSettingsResolvingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/MatchSettingsResolvingTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -13,49 +13,49 @@ import java.io.IOException;
public class MatchSettingsResolvingTestCase extends AbstractExportingTestCase {
@Test
- public void testSimpleDefaults() throws IOException, ParseException {
+ void testSimpleDefaults() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_simple_def", new TestProperties());
}
@Test
- public void testSimpleWithStructSettings() throws IOException, ParseException {
+ void testSimpleWithStructSettings() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_simple_wss",
- new TestProperties());
+ new TestProperties());
}
@Test
- public void testSimpleWithFieldSettings() throws IOException, ParseException {
+ void testSimpleWithFieldSettings() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_simple_wfs", new TestProperties());
}
@Test
- public void testSimpleStructAndFieldSettings() throws IOException, ParseException {
+ void testSimpleStructAndFieldSettings() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_simple_wss_wfs", new TestProperties());
}
@Test
- public void testMapDefaults() throws IOException, ParseException {
+ void testMapDefaults() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_map_def", new TestProperties());
}
@Test
- public void testMapWithStructSettings() throws IOException, ParseException {
+ void testMapWithStructSettings() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_map_wss", new TestProperties());
}
@Test
- public void testMapWithFieldSettings() throws IOException, ParseException {
+ void testMapWithFieldSettings() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_map_wfs", new TestProperties());
}
@Test
- public void testMapAfter() throws IOException, ParseException {
+ void testMapAfter() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_map_after", new TestProperties());
}
@Test
- public void testMapInStruct() throws IOException, ParseException {
+ void testMapInStruct() throws IOException, ParseException {
assertCorrectDeriving("matchsettings_map_in_struct", new TestProperties());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/MultiStructTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/MultiStructTestCase.java
index 66b3698b38c..7276a5be445 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/MultiStructTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/MultiStructTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.application.provider.MockFileRegistry;
import com.yahoo.schema.ApplicationBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests deriving a configuration with structs in multiple .sd files
@@ -14,11 +14,11 @@ import org.junit.Test;
public class MultiStructTestCase extends AbstractExportingTestCase {
@Test
- public void testDocTypeConfigs() throws Exception {
+ void testDocTypeConfigs() throws Exception {
var logger = new TestableDeployLogger();
var props = new TestProperties();
ApplicationBuilder builder = ApplicationBuilder.createFromDirectory
- ("src/test/derived/multi_struct/", new MockFileRegistry(), logger, props);
+ ("src/test/derived/multi_struct/", new MockFileRegistry(), logger, props);
derive("multi_struct", builder, builder.getSchema("shop"));
assertCorrectConfigFiles("multi_struct");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/MultipleSummariesTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/MultipleSummariesTestCase.java
index d434673e43a..8642c45f16d 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/MultipleSummariesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/MultipleSummariesTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,7 +15,7 @@ import java.io.IOException;
public class MultipleSummariesTestCase extends AbstractExportingTestCase {
@Test
- public void testMultipleSummariesNew() throws IOException, ParseException {
+ void testMultipleSummariesNew() throws IOException, ParseException {
assertCorrectDeriving("multiplesummaries", new TestProperties());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/NameCollisionTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/NameCollisionTestCase.java
index 689ff9814cc..260dc9e4fdd 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/NameCollisionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/NameCollisionTestCase.java
@@ -5,8 +5,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.document.DocumentTypeManager;
-import org.junit.Test;
-import static org.junit.Assert.assertThrows;
+import org.junit.jupiter.api.Test;
/**
* Verifies that a struct in a document type is preferred over another document type
@@ -17,10 +16,10 @@ import static org.junit.Assert.assertThrows;
public class NameCollisionTestCase extends AbstractExportingTestCase {
@Test
- public void testNameCollision() throws Exception {
+ void testNameCollision() throws Exception {
assertCorrectDeriving("namecollision", "collisionstruct",
- new TestProperties(),
- new TestableDeployLogger());
+ new TestProperties(),
+ new TestableDeployLogger());
DocumentTypeManager.fromFile("temp/namecollision/documentmanager.cfg");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/NativeRankTypeDefinitionsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/NativeRankTypeDefinitionsTestCase.java
index f628420556a..c51567b6629 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/NativeRankTypeDefinitionsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/NativeRankTypeDefinitionsTestCase.java
@@ -3,11 +3,11 @@ package com.yahoo.schema.derived;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.RankType;
-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.*;
/**
* Testing stuff related to native rank type definitions
@@ -16,15 +16,16 @@ import static org.junit.Assert.*;
*/
public class NativeRankTypeDefinitionsTestCase extends AbstractSchemaTestCase {
@Test
- public void testTables() {
+ void testTables() {
assertEquals(NativeTable.Type.FIRST_OCCURRENCE.getName(), "firstOccurrenceTable");
assertEquals(NativeTable.Type.OCCURRENCE_COUNT.getName(), "occurrenceCountTable");
assertEquals(NativeTable.Type.PROXIMITY.getName(), "proximityTable");
assertEquals(NativeTable.Type.REVERSE_PROXIMITY.getName(), "reverseProximityTable");
assertEquals(NativeTable.Type.WEIGHT.getName(), "weightTable");
}
+
@Test
- public void testDefinitions() {
+ void testDefinitions() {
NativeRankTypeDefinitionSet defs = new NativeRankTypeDefinitionSet("default");
NativeRankTypeDefinition rank;
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/NearestNeighborTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/NearestNeighborTestCase.java
index 2f3ad7cfc69..b3a0b8d4558 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/NearestNeighborTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/NearestNeighborTestCase.java
@@ -6,24 +6,25 @@ import com.yahoo.search.Query;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
public class NearestNeighborTestCase extends AbstractExportingTestCase {
@Test
- public void testNearestNeighbor() throws IOException, ParseException {
+ void testNearestNeighbor() throws IOException, ParseException {
try {
ComponentId.resetGlobalCountersForTests();
DerivedConfiguration c = assertCorrectDeriving("nearestneighbor");
- CompiledQueryProfileRegistry queryProfiles = CompiledQueryProfileRegistry.fromConfig(new QueryProfiles(c.getQueryProfiles(), (level, message) -> {}).getConfig());
+ CompiledQueryProfileRegistry queryProfiles = CompiledQueryProfileRegistry.fromConfig(new QueryProfiles(c.getQueryProfiles(), (level, message) -> {
+ }).getConfig());
Query q = new Query("?ranking.features.query(q_vec)=[1,2,3,4,5,6]", // length is 6, not 5
- queryProfiles.getComponent("default"));
+ queryProfiles.getComponent("default"));
fail("This should fail when q_vec is parsed as a tensor");
} catch (IllegalArgumentException e) {
// success
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/NeuralNetTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/NeuralNetTestCase.java
index 56248c02a51..18dddff3984 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/NeuralNetTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/NeuralNetTestCase.java
@@ -6,27 +6,28 @@ import com.yahoo.search.query.profile.compiled.CompiledQueryProfile;
import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import com.yahoo.component.ComponentId;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class NeuralNetTestCase extends AbstractExportingTestCase {
@Test
- public void testNeuralNet() throws IOException, ParseException {
+ void testNeuralNet() throws IOException, ParseException {
ComponentId.resetGlobalCountersForTests();
DerivedConfiguration c = assertCorrectDeriving("neuralnet");
// Verify that query profiles end up correct when passed through the same intermediate forms as a full system
- CompiledQueryProfileRegistry queryProfiles = CompiledQueryProfileRegistry.fromConfig(new QueryProfiles(c.getQueryProfiles(), (level, message) -> {}).getConfig());
+ CompiledQueryProfileRegistry queryProfiles = CompiledQueryProfileRegistry.fromConfig(new QueryProfiles(c.getQueryProfiles(), (level, message) -> {
+ }).getConfig());
assertNeuralNetQuery(c, queryProfiles.getComponent("default"));
}
@Test
- public void testNeuralNet_noQueryProfiles() throws IOException, ParseException {
+ void testNeuralNet_noQueryProfiles() throws IOException, ParseException {
ComponentId.resetGlobalCountersForTests();
DerivedConfiguration c = assertCorrectDeriving("neuralnet_noqueryprofile");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/NuwaTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/NuwaTestCase.java
index 210c8a9bdd4..4f30169713a 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/NuwaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/NuwaTestCase.java
@@ -2,8 +2,8 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,8 +15,8 @@ import java.io.IOException;
public class NuwaTestCase extends AbstractExportingTestCase {
@Test
- @Ignore
- public void testNuwa() throws IOException, ParseException {
+ @Disabled
+ void testNuwa() throws IOException, ParseException {
System.gc();
long freeBytesBefore = Runtime.getRuntime().freeMemory();
long totalBytesBefore = Runtime.getRuntime().totalMemory();
@@ -27,7 +27,7 @@ public class NuwaTestCase extends AbstractExportingTestCase {
long freeBytesAfter = Runtime.getRuntime().freeMemory();
long totalBytesAfter = Runtime.getRuntime().totalMemory();
long additionalAllocated = totalBytesAfter - totalBytesBefore;
- System.out.println("Consumed " + ((freeBytesBefore - (freeBytesAfter - additionalAllocated) ) / 1000000) + " Mb");
+ System.out.println("Consumed " + ((freeBytesBefore - (freeBytesAfter - additionalAllocated)) / 1000000) + " Mb");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/OrderIlscriptsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/OrderIlscriptsTestCase.java
index 8af0d0a21d3..741f1fd7e02 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/OrderIlscriptsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/OrderIlscriptsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,7 +12,7 @@ import java.io.IOException;
public class OrderIlscriptsTestCase extends AbstractExportingTestCase {
@Test
- public void testOrderIlscripts() throws IOException, ParseException {
+ void testOrderIlscripts() throws IOException, ParseException {
assertCorrectDeriving("orderilscripts");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/PrefixExactAttributeTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/PrefixExactAttributeTestCase.java
index fdcb71432e4..7faea410da2 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/PrefixExactAttributeTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/PrefixExactAttributeTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,7 +14,7 @@ import java.io.IOException;
public class PrefixExactAttributeTestCase extends AbstractExportingTestCase {
@Test
- public void testTypes() throws IOException, ParseException {
+ void testTypes() throws IOException, ParseException {
assertCorrectDeriving("prefixexactattribute");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/RankProfilesTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/RankProfilesTestCase.java
index a83db0caf5a..5c24b32e275 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/RankProfilesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/RankProfilesTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,7 +14,7 @@ import java.io.IOException;
*/
public class RankProfilesTestCase extends AbstractExportingTestCase {
@Test
- public void testRankProfiles() throws IOException, ParseException {
+ void testRankProfiles() throws IOException, ParseException {
assertCorrectDeriving("rankprofiles", null, new TestProperties(), new TestableDeployLogger());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/RankPropertiesTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/RankPropertiesTestCase.java
index 8db880e56fe..c46cd5e53c6 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/RankPropertiesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/RankPropertiesTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,7 +12,7 @@ import java.io.IOException;
public class RankPropertiesTestCase extends AbstractExportingTestCase {
@Test
- public void testRankProperties() throws IOException, ParseException {
+ void testRankProperties() throws IOException, ParseException {
assertCorrectDeriving("rankproperties");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFieldsTestCase.java
index 99d0cf8bf6d..2d9487d4a5e 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFieldsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,7 +12,7 @@ import java.io.IOException;
public class ReferenceFieldsTestCase extends AbstractExportingTestCase {
@Test
- public void configs_related_to_reference_fields_are_derived() throws IOException, ParseException {
+ void configs_related_to_reference_fields_are_derived() throws IOException, ParseException {
assertCorrectDeriving("reference_fields", "ad", new TestableDeployLogger());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFromSeveralTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFromSeveralTestCase.java
index ff4506a7f57..caa5bf1b4a9 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFromSeveralTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/ReferenceFromSeveralTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.application.provider.MockFileRegistry;
import com.yahoo.schema.ApplicationBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests deriving a configuration with references from multiple .sd files
@@ -14,11 +14,11 @@ import org.junit.Test;
public class ReferenceFromSeveralTestCase extends AbstractExportingTestCase {
@Test
- public void testDocManConfigs() throws Exception {
+ void testDocManConfigs() throws Exception {
var logger = new TestableDeployLogger();
var props = new TestProperties();
ApplicationBuilder builder = ApplicationBuilder.createFromDirectory
- ("src/test/derived/reference_from_several/", new MockFileRegistry(), logger, props);
+ ("src/test/derived/reference_from_several/", new MockFileRegistry(), logger, props);
derive("reference_from_several", builder, builder.getSchema("foo"));
assertCorrectConfigFiles("reference_from_several");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SchemaInheritanceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SchemaInheritanceTestCase.java
index 1b5d55158b5..f115f69cc8f 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SchemaInheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SchemaInheritanceTestCase.java
@@ -6,7 +6,7 @@ import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.io.IOUtils;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
@@ -17,12 +17,12 @@ import java.io.IOException;
public class SchemaInheritanceTestCase extends AbstractExportingTestCase {
@Test
- public void testIt() throws IOException, ParseException {
+ void testIt() throws IOException, ParseException {
try {
ApplicationBuilder builder = ApplicationBuilder.createFromDirectory("src/test/derived/schemainheritance/",
- new MockFileRegistry(),
- new TestableDeployLogger(),
- new TestProperties());
+ new MockFileRegistry(),
+ new TestableDeployLogger(),
+ new TestProperties());
derive("schemainheritance", builder, builder.getSchema("child"));
assertCorrectConfigFiles("schemainheritance");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
index 4683bccb0ad..16001d3912d 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
@@ -10,7 +10,7 @@ import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporarySDField;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.HashMap;
@@ -20,7 +20,7 @@ import java.util.Objects;
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.toList;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author bratseth
@@ -102,45 +102,45 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
@Test
- public void testPerfectOrderingIsKept() {
+ void testPerfectOrderingIsKept() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone"));
+ Arrays.asList("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone"));
}
@Test
- public void testOneLevelReordering() {
+ void testOneLevelReordering() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone"));
+ Arrays.asList("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone"));
}
@Test
- public void testMultiLevelReordering() {
+ void testMultiLevelReordering() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone"));
+ Arrays.asList("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone"));
}
@Test
- public void testAloneIsKeptInPlaceWithMultiLevelReordering() {
+ void testAloneIsKeptInPlaceWithMultiLevelReordering() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product"));
+ Arrays.asList("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product"));
}
@Test
- public void testPartialMultiLevelReordering() {
+ void testPartialMultiLevelReordering() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone"));
+ Arrays.asList("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone"));
}
@Test
- public void testMultilevelReorderingAccrossHierarchies() {
+ void testMultilevelReorderingAccrossHierarchies() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
+ Arrays.asList("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
}
@Test
- public void referees_are_ordered_before_referrer() {
+ void referees_are_ordered_before_referrer() {
assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "accessory-pc", "son"),
- Arrays.asList("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
+ Arrays.asList("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SimpleInheritTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SimpleInheritTestCase.java
index d8b39bfd978..e5b95e8a6ca 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SimpleInheritTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SimpleInheritTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.schema.derived;
import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
@@ -15,7 +15,7 @@ import java.io.IOException;
public class SimpleInheritTestCase extends AbstractExportingTestCase {
@Test
- public void testEmptyChild() throws IOException, ParseException {
+ void testEmptyChild() throws IOException, ParseException {
String name = "emptychild";
final String expectedResultsDirName = "src/test/derived/" + name + "/";
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SliceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SliceTestCase.java
index 2aad47dae6c..9ef664bd287 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SliceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SliceTestCase.java
@@ -3,19 +3,17 @@ package com.yahoo.schema.derived;
import com.yahoo.component.ComponentId;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
-
/**
* @author bratseth
*/
public class SliceTestCase extends AbstractExportingTestCase {
@Test
- public void testSlice() throws IOException, ParseException {
+ void testSlice() throws IOException, ParseException {
ComponentId.resetGlobalCountersForTests();
DerivedConfiguration c = assertCorrectDeriving("slice");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SortingTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SortingTestCase.java
index 0c091a7a367..a4590075a79 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SortingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SortingTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,7 +15,7 @@ import java.io.IOException;
public class SortingTestCase extends AbstractExportingTestCase {
@Test
- public void testDocumentDerivingNewParser() throws IOException, ParseException {
+ void testDocumentDerivingNewParser() throws IOException, ParseException {
assertCorrectDeriving("sorting", new TestProperties());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/StreamingStructTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/StreamingStructTestCase.java
index 6f27930e239..1524801bad7 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/StreamingStructTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/StreamingStructTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,12 +14,12 @@ import java.io.IOException;
public class StreamingStructTestCase extends AbstractExportingTestCase {
@Test
- public void testStreamingStruct() throws IOException, ParseException {
+ void testStreamingStruct() throws IOException, ParseException {
assertCorrectDeriving("streamingstruct");
}
@Test
- public void testStreamingStructExplicitDefaultSummaryClass() throws IOException, ParseException {
+ void testStreamingStructExplicitDefaultSummaryClass() throws IOException, ParseException {
assertCorrectDeriving("streamingstructdefault");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/StructAnyOrderTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/StructAnyOrderTestCase.java
index 865b5da87cf..9a1bba88cc6 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/StructAnyOrderTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/StructAnyOrderTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -11,7 +11,7 @@ import java.io.IOException;
*/
public class StructAnyOrderTestCase extends AbstractExportingTestCase {
@Test
- public void testStructAnyOrder() throws IOException, ParseException {
+ void testStructAnyOrder() throws IOException, ParseException {
assertCorrectDeriving("structanyorder");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/StructInheritanceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/StructInheritanceTestCase.java
index 092e64420e8..60be9dc9016 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/StructInheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/StructInheritanceTestCase.java
@@ -5,14 +5,14 @@ package com.yahoo.schema.derived;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import java.io.File;
import java.io.IOException;
-
-import org.junit.rules.TemporaryFolder;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests struct inheritance
@@ -21,15 +21,11 @@ import org.junit.rules.TemporaryFolder;
*/
public class StructInheritanceTestCase extends AbstractExportingTestCase {
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
-
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
+ @TempDir
+ public File tmpDir;
@Test
- public void requireThatStructCanInherit() throws IOException, ParseException {
+ void requireThatStructCanInherit() throws IOException, ParseException {
String dir = "src/test/derived/structinheritance/";
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchemaFile(dir + "simple.sd");
@@ -39,14 +35,15 @@ public class StructInheritanceTestCase extends AbstractExportingTestCase {
}
@Test
- public void requireThatRedeclareIsNotAllowed() throws IOException, ParseException {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("cannot inherit from base and redeclare field name");
- String dir = "src/test/derived/structinheritance/";
- ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "bad.sd");
- builder.build(true);
- derive("structinheritance", builder, builder.getSchema("bad"));
+ void requireThatRedeclareIsNotAllowed() throws IOException, ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ String dir = "src/test/derived/structinheritance/";
+ ApplicationBuilder builder = new ApplicationBuilder();
+ builder.addSchemaFile(dir + "bad.sd");
+ builder.build(true);
+ derive("structinheritance", builder, builder.getSchema("bad"));
+ });
+ assertTrue(exception.getMessage().contains("cannot inherit from base and redeclare field name"));
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SummaryMapTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SummaryMapTestCase.java
index 23cd7952626..577bcf6efcc 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SummaryMapTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SummaryMapTestCase.java
@@ -12,16 +12,15 @@ import com.yahoo.schema.parser.ParseException;
import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.documentmodel.SummaryTransform;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-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.*;
+
/**
* Tests summary map extraction
*
@@ -29,7 +28,7 @@ import static org.junit.Assert.assertTrue;
*/
public class SummaryMapTestCase extends AbstractSchemaTestCase {
@Test
- public void testDeriving() throws IOException, ParseException {
+ void testDeriving() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/simple.sd");
SummaryMap summaryMap = new SummaryMap(schema);
@@ -76,8 +75,9 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
assertFalse(transforms.hasNext());
}
+
@Test
- public void testPositionDeriving() {
+ void testPositionDeriving() {
Schema schema = new Schema("store", MockApplicationPackage.createEmpty());
SDDocumentType document = new SDDocumentType("store");
schema.addDocument(document);
@@ -85,7 +85,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
SDField field = document.addField(fieldName, PositionDataType.INSTANCE);
field.parseIndexingScript("{ attribute | summary }");
new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(),
- true, false, Set.of());
+ true, false, Set.of());
SummaryMap summaryMap = new SummaryMap(schema);
Iterator<FieldResultTransform> transforms = summaryMap.resultTransforms().values().iterator();
@@ -105,18 +105,18 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
transform = transforms.next();
assertEquals("location_zcurve", transform.getFieldName());
- assertEquals(SummaryTransform.ATTRIBUTE,transform.getTransform());
+ assertEquals(SummaryTransform.ATTRIBUTE, transform.getTransform());
transform = transforms.next();
assertEquals("documentid", transform.getFieldName());
- assertEquals(SummaryTransform.DOCUMENT_ID,transform.getTransform());
+ assertEquals(SummaryTransform.DOCUMENT_ID, transform.getTransform());
assertFalse(transforms.hasNext());
SummarymapConfig.Builder scb = new SummarymapConfig.Builder();
summaryMap.getConfig(scb);
SummarymapConfig c = scb.build();
-
+
assertEquals(-1, c.defaultoutputclass());
assertEquals(c.override().size(), 5);
@@ -127,7 +127,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
assertEquals(c.override(1).field(), "rankfeatures");
assertEquals(c.override(1).command(), "rankfeatures");
assertEquals(c.override(1).arguments(), "");
-
+
assertEquals(c.override(2).field(), "summaryfeatures");
assertEquals(c.override(2).command(), "summaryfeatures");
assertEquals(c.override(2).arguments(), "");
@@ -138,7 +138,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testFailOnSummaryFieldSourceCollision() {
+ void testFailOnSummaryFieldSourceCollision() {
try {
ApplicationBuilder.buildFromFile("src/test/examples/summaryfieldcollision.sd");
} catch (Exception e) {
@@ -147,7 +147,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
}
@Test
- public void source_field_is_passed_as_argument_in_matched_elements_filter_transforms() throws ParseException {
+ void source_field_is_passed_as_argument_in_matched_elements_filter_transforms() throws ParseException {
assertOverride(joinLines("field my_field type map<string, string> {",
" indexing: summary",
" summary: matched-elements-only",
@@ -163,7 +163,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
}
@Test
- public void commands_that_are_dynamic_and_require_the_query() {
+ void commands_that_are_dynamic_and_require_the_query() {
assertTrue(SummaryMap.isDynamicCommand("dynamicteaser"));
assertTrue(SummaryMap.isDynamicCommand(SummaryTransform.MATCHED_ELEMENTS_FILTER.getName()));
assertTrue(SummaryMap.isDynamicCommand(SummaryTransform.MATCHED_ATTRIBUTE_ELEMENTS_FILTER.getName()));
@@ -171,7 +171,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
}
@Test
- public void documentid_summary_field_has_corresponding_summary_transform() throws ParseException {
+ void documentid_summary_field_has_corresponding_summary_transform() throws ParseException {
var schema = buildSchema("field foo type string { indexing: summary }",
joinLines("document-summary bar {",
" summary documentid type string {}",
@@ -180,7 +180,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase {
}
@Test
- public void documentid_summary_transform_requires_disk_access() {
+ void documentid_summary_transform_requires_disk_access() {
assertFalse(SummaryTransform.DOCUMENT_ID.isInMemory());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
index 73713319cfe..a9a230c94a2 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
@@ -7,15 +7,14 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.config.search.SummaryConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Iterator;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
/**
* Tests summary extraction
@@ -25,7 +24,7 @@ import static org.junit.Assert.assertTrue;
public class SummaryTestCase extends AbstractSchemaTestCase {
@Test
- public void deriveRawAsBase64() throws ParseException {
+ void deriveRawAsBase64() throws ParseException {
String sd = joinLines(
"schema s {",
" document s {",
@@ -40,7 +39,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
}
@Test
- public void deriveRawAsLegacy() throws ParseException {
+ void deriveRawAsLegacy() throws ParseException {
String sd = joinLines(
"schema s {",
" raw-as-base64-in-summary: false",
@@ -56,7 +55,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testDeriving() throws IOException, ParseException {
+ void testDeriving() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/simple.sd");
SummaryClass summary = new SummaryClass(schema, schema.getSummary("default"), new BaseDeployLogger());
assertEquals("default", summary.getName());
@@ -121,7 +120,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
}
@Test
- public void reference_fields_can_be_part_of_summary_classes() throws ParseException {
+ void reference_fields_can_be_part_of_summary_classes() throws ParseException {
Schema adSchema = buildCampaignAdModel();
SummaryClass defaultClass = new SummaryClass(adSchema, adSchema.getSummary("default"), new BaseDeployLogger());
@@ -154,7 +153,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
}
@Test
- public void omit_summary_features_specified_for_document_summary() throws ParseException {
+ void omit_summary_features_specified_for_document_summary() throws ParseException {
String sd = joinLines(
"schema test {",
" document test {",
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/TokenizationTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/TokenizationTestCase.java
index ac6acf172e9..c8a2279a407 100755
--- a/config-model/src/test/java/com/yahoo/schema/derived/TokenizationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/TokenizationTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -12,7 +12,7 @@ import java.io.IOException;
public class TokenizationTestCase extends AbstractExportingTestCase {
@Test
- public void testTokenizationScripts() throws IOException, ParseException {
+ void testTokenizationScripts() throws IOException, ParseException {
assertCorrectDeriving("tokenization");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/TwoStreamingStructsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/TwoStreamingStructsTestCase.java
index 72411fa1770..5db9a00ce69 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/TwoStreamingStructsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/TwoStreamingStructsTestCase.java
@@ -3,7 +3,7 @@ package com.yahoo.schema.derived;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,7 +15,7 @@ import java.io.IOException;
public class TwoStreamingStructsTestCase extends AbstractExportingTestCase {
@Test
- public void testTwoStreamingStructsExporting() throws ParseException, IOException {
+ void testTwoStreamingStructsExporting() throws ParseException, IOException {
String root = "src/test/derived/twostreamingstructs";
ApplicationBuilder builder = new ApplicationBuilder();
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
index 84a561924ca..fd9f2164b86 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
@@ -11,11 +11,12 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Set;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
/**
* Tests automatic type conversion using multifield indices
*
@@ -25,7 +26,7 @@ public class TypeConversionTestCase extends AbstractSchemaTestCase {
/** Tests that exact-string stuff is not spilled over to the default index */
@Test
- public void testExactStringToStringTypeConversion() {
+ void testExactStringToStringTypeConversion() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty());
RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema);
SDDocumentType document = new SDDocumentType("test");
@@ -35,7 +36,7 @@ public class TypeConversionTestCase extends AbstractSchemaTestCase {
document.addField(a);
new Processing().process(schema, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(),
- true, false, Set.of());
+ true, false, Set.of());
DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry);
IndexInfo indexInfo = derived.getIndexInfo();
assertFalse(indexInfo.hasCommand("default", "compact-to-term"));
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/TypesTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/TypesTestCase.java
index 7443ef01c95..348d156a5f9 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/TypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/TypesTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.derived;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,7 +14,7 @@ import java.io.IOException;
public class TypesTestCase extends AbstractExportingTestCase {
@Test
- public void testTypes() throws IOException, ParseException {
+ void testTypes() throws IOException, ParseException {
assertCorrectDeriving("types");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
index c59f82a2c12..4b478d7da35 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
@@ -10,9 +10,9 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporarySDField;
import com.yahoo.vespa.config.search.vsm.VsmfieldsConfig;
-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 geirst
@@ -21,7 +21,7 @@ public class VsmFieldsTestCase {
@SuppressWarnings("deprecation")
@Test
- public void reference_type_field_is_unsearchable() {
+ void reference_type_field_is_unsearchable() {
Schema schema = new Schema("test", MockApplicationPackage.createEmpty(), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties());
var sdoc = new SDDocumentType("test");
schema.addDocument(sdoc);
diff --git a/config-model/src/test/java/com/yahoo/schema/document/ComplexAttributeFieldUtilsTestCase.java b/config-model/src/test/java/com/yahoo/schema/document/ComplexAttributeFieldUtilsTestCase.java
index ea3f207df91..7a89f52268f 100644
--- a/config-model/src/test/java/com/yahoo/schema/document/ComplexAttributeFieldUtilsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/document/ComplexAttributeFieldUtilsTestCase.java
@@ -4,11 +4,11 @@ package com.yahoo.schema.document;
import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class ComplexAttributeFieldUtilsTestCase {
@@ -77,7 +77,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void array_of_struct_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void array_of_struct_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
Fixture f = new Fixture("elem_array",
joinLines("field elem_array type array<elem> {",
" indexing: summary",
@@ -90,7 +90,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void array_of_struct_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void array_of_struct_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
Fixture f = new Fixture("elem_array",
joinLines("field elem_array type array<elem> {",
" indexing: summary",
@@ -102,7 +102,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void map_of_struct_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void map_of_struct_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
Fixture f = new Fixture("elem_map",
joinLines("field elem_map type map<string, elem> {",
" indexing: summary",
@@ -117,7 +117,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void map_of_struct_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void map_of_struct_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
{
Fixture f = new Fixture("elem_map",
joinLines("field elem_map type map<int, elem> {",
@@ -145,7 +145,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void map_of_primitive_type_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void map_of_primitive_type_with_only_struct_field_attributes_is_tagged_as_such() throws ParseException {
Fixture f = new Fixture("str_map",
joinLines("field str_map type map<string, string> {",
" indexing: summary",
@@ -159,7 +159,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void map_of_primitive_type_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
+ void map_of_primitive_type_with_some_struct_field_attributes_is_tagged_as_such() throws ParseException {
{
Fixture f = new Fixture("int_map",
joinLines("field int_map type map<int, int> {",
@@ -185,7 +185,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void unsupported_complex_field_is_tagged_as_such() throws ParseException {
+ void unsupported_complex_field_is_tagged_as_such() throws ParseException {
{
ComplexFixture f = new ComplexFixture("elem_array",
joinLines("field elem_array type array<elem> {",
@@ -214,7 +214,7 @@ public class ComplexAttributeFieldUtilsTestCase {
}
@Test
- public void only_struct_field_attributes_are_considered_when_tagging_a_complex_field() throws ParseException {
+ void only_struct_field_attributes_are_considered_when_tagging_a_complex_field() throws ParseException {
{
ComplexFixture f = new ComplexFixture("elem_array",
joinLines("field elem_array type array<elem> {",
diff --git a/config-model/src/test/java/com/yahoo/schema/document/HnswIndexParamsTestCase.java b/config-model/src/test/java/com/yahoo/schema/document/HnswIndexParamsTestCase.java
index 8ef51369ecb..51affaa0cc4 100644
--- a/config-model/src/test/java/com/yahoo/schema/document/HnswIndexParamsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/document/HnswIndexParamsTestCase.java
@@ -3,7 +3,7 @@
package com.yahoo.schema.document;
import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -11,7 +11,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
public class HnswIndexParamsTestCase {
@Test
- public void override_from() throws Exception {
+ void override_from() throws Exception {
var empty = new HnswIndexParams();
var builder = new HnswIndexParams.Builder();
builder.setMaxLinksPerNode(7);
diff --git a/config-model/src/test/java/com/yahoo/schema/parser/ConvertIntermediateTestCase.java b/config-model/src/test/java/com/yahoo/schema/parser/ConvertIntermediateTestCase.java
index 516c259013f..8f9f8032054 100644
--- a/config-model/src/test/java/com/yahoo/schema/parser/ConvertIntermediateTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/parser/ConvertIntermediateTestCase.java
@@ -4,10 +4,10 @@ package com.yahoo.schema.parser;
import com.yahoo.document.DocumentTypeManager;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertThrows;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author arnej
@@ -15,12 +15,12 @@ import static org.junit.Assert.assertThrows;
public class ConvertIntermediateTestCase {
@Test
- public void can_convert_minimal_schema() throws Exception {
+ void can_convert_minimal_schema() throws Exception {
String input = joinLines
- ("schema foo {",
- " document foo {",
- " }",
- "}");
+ ("schema foo {",
+ " document foo {",
+ " }",
+ "}");
var collection = new IntermediateCollection();
ParsedSchema schema = collection.addSchemaFromString(input);
assertEquals("foo", schema.getDocument().name());
@@ -32,7 +32,7 @@ public class ConvertIntermediateTestCase {
}
@Test
- public void can_convert_schema_files() throws Exception {
+ void can_convert_schema_files() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromFile("src/test/derived/deriver/child.sd");
collection.addSchemaFromFile("src/test/derived/deriver/grandparent.sd");
@@ -50,7 +50,7 @@ public class ConvertIntermediateTestCase {
}
@Test
- public void can_convert_structs_and_annotations() throws Exception {
+ void can_convert_structs_and_annotations() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromFile("src/test/converter/child.sd");
collection.addSchemaFromFile("src/test/converter/other.sd");
@@ -62,34 +62,34 @@ public class ConvertIntermediateTestCase {
var dt = docMan.getDocumentType("child");
assertTrue(dt != null);
for (var parent : dt.getInheritedTypes()) {
- System.err.println("dt "+dt.getName()+" inherits from "+parent.getName());
+ System.err.println("dt " + dt.getName() + " inherits from " + parent.getName());
}
for (var field : dt.fieldSetAll()) {
- System.err.println("dt "+dt.getName()+" contains field "+field.getName()+" of type "+field.getDataType());
+ System.err.println("dt " + dt.getName() + " contains field " + field.getName() + " of type " + field.getDataType());
}
dt = docMan.getDocumentType("parent");
assertTrue(dt != null);
for (var parent : dt.getInheritedTypes()) {
- System.err.println("dt "+dt.getName()+" inherits from "+parent.getName());
+ System.err.println("dt " + dt.getName() + " inherits from " + parent.getName());
}
for (var field : dt.fieldSetAll()) {
- System.err.println("dt "+dt.getName()+" contains field "+field.getName()+" of type "+field.getDataType());
+ System.err.println("dt " + dt.getName() + " contains field " + field.getName() + " of type " + field.getDataType());
}
dt = docMan.getDocumentType("grandparent");
assertTrue(dt != null);
for (var parent : dt.getInheritedTypes()) {
- System.err.println("dt "+dt.getName()+" inherits from "+parent.getName());
+ System.err.println("dt " + dt.getName() + " inherits from " + parent.getName());
}
for (var field : dt.fieldSetAll()) {
- System.err.println("dt "+dt.getName()+" contains field "+field.getName()+" of type "+field.getDataType());
+ System.err.println("dt " + dt.getName() + " contains field " + field.getName() + " of type " + field.getDataType());
}
dt = docMan.getDocumentType("other");
assertTrue(dt != null);
for (var parent : dt.getInheritedTypes()) {
- System.err.println("dt "+dt.getName()+" inherits from "+parent.getName());
+ System.err.println("dt " + dt.getName() + " inherits from " + parent.getName());
}
for (var field : dt.fieldSetAll()) {
- System.err.println("dt "+dt.getName()+" contains field "+field.getName()+" of type "+field.getDataType());
+ System.err.println("dt " + dt.getName() + " contains field " + field.getName() + " of type " + field.getDataType());
}
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java b/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
index c4ee1d27c8c..6ebfea41d84 100644
--- a/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
@@ -10,10 +10,9 @@ import java.io.File;
import java.io.FileReader;
import java.util.List;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertThrows;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author arnej
@@ -21,12 +20,12 @@ import static org.junit.Assert.assertThrows;
public class IntermediateCollectionTestCase {
@Test
- public void can_add_minimal_schema() throws Exception {
+ void can_add_minimal_schema() throws Exception {
String input = joinLines
- ("schema foo {",
- " document foo {",
- " }",
- "}");
+ ("schema foo {",
+ " document foo {",
+ " }",
+ "}");
var collection = new IntermediateCollection();
ParsedSchema schema = collection.addSchemaFromString(input);
assertEquals("foo", schema.name());
@@ -35,12 +34,12 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void names_may_differ() throws Exception {
+ void names_may_differ() throws Exception {
String input = joinLines
- ("schema foo_search {",
- " document foo {",
- " }",
- "}");
+ ("schema foo_search {",
+ " document foo {",
+ " }",
+ "}");
var collection = new IntermediateCollection();
ParsedSchema schema = collection.addSchemaFromString(input);
assertEquals("foo_search", schema.name());
@@ -49,7 +48,7 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void can_add_schema_files() throws Exception {
+ void can_add_schema_files() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromFile("src/test/derived/deriver/child.sd");
collection.addSchemaFromFile("src/test/derived/deriver/grandparent.sd");
@@ -75,7 +74,7 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void can_add_schemas() throws Exception {
+ void can_add_schemas() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromReader(readerOf("src/test/derived/deriver/child.sd"));
collection.addSchemaFromReader(readerOf("src/test/derived/deriver/grandparent.sd"));
@@ -101,7 +100,7 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void can_add_extra_rank_profiles() throws Exception {
+ void can_add_extra_rank_profiles() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromFile("src/test/derived/rankprofilemodularity/test.sd");
collection.addRankProfileFile("test", "src/test/derived/rankprofilemodularity/test/outside_schema1.profile");
@@ -128,32 +127,32 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void name_mismatch_throws() throws Exception {
+ void name_mismatch_throws() throws Exception {
var collection = new IntermediateCollection();
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.addSchemaFromReader(readerOf("src/test/cfg/application/sdfilenametest/schemas/notmusic.sd")));
+ collection.addSchemaFromReader(readerOf("src/test/cfg/application/sdfilenametest/schemas/notmusic.sd")));
assertEquals("The file containing schema 'music' must be named 'music.sd', was 'notmusic.sd'",
- ex.getMessage());
+ ex.getMessage());
}
@Test
- public void bad_parse_throws() throws Exception {
+ void bad_parse_throws() throws Exception {
var collection = new IntermediateCollection();
var ex = assertThrows(ParseException.class, () ->
- collection.addSchemaFromFile("src/test/examples/badparse.sd"));
+ collection.addSchemaFromFile("src/test/examples/badparse.sd"));
assertTrue(ex.getMessage().startsWith("Failed parsing schema from src/test/examples/badparse.sd: Encountered"));
ex = assertThrows(ParseException.class, () ->
- collection.addSchemaFromReader(readerOf("src/test/examples/badparse.sd")));
+ collection.addSchemaFromReader(readerOf("src/test/examples/badparse.sd")));
assertTrue(ex.getMessage().startsWith("Failed parsing schema from src/test/examples/badparse.sd: Encountered"));
collection.addSchemaFromFile("src/test/derived/rankprofilemodularity/test.sd");
collection.addRankProfileFile("test", "src/test/derived/rankprofilemodularity/test/outside_schema1.profile");
ex = assertThrows(ParseException.class, () ->
- collection.addRankProfileFile("test", "src/test/examples/badparse.sd"));
+ collection.addRankProfileFile("test", "src/test/examples/badparse.sd"));
assertTrue(ex.getMessage().startsWith("Failed parsing rank-profile from src/test/examples/badparse.sd: Encountered"));
}
@Test
- public void can_resolve_document_inheritance() throws Exception {
+ void can_resolve_document_inheritance() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromFile("src/test/derived/deriver/child.sd");
collection.addSchemaFromFile("src/test/derived/deriver/grandparent.sd");
@@ -172,63 +171,63 @@ public class IntermediateCollectionTestCase {
}
@Test
- public void can_detect_schema_inheritance_cycles() throws Exception {
+ void can_detect_schema_inheritance_cycles() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromString("schema foo inherits bar { document foo {} }");
collection.addSchemaFromString("schema bar inherits qux { document bar {} }");
collection.addSchemaFromString("schema qux inherits foo { document qux {} }");
assertEquals(collection.getParsedSchemas().size(), 3);
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.resolveInternalConnections());
+ collection.resolveInternalConnections());
assertTrue(ex.getMessage().startsWith("Inheritance/reference cycle for schemas: "));
}
@Test
- public void can_detect_document_inheritance_cycles() throws Exception {
+ void can_detect_document_inheritance_cycles() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromString("schema foo { document foo inherits bar {} }");
collection.addSchemaFromString("schema bar { document bar inherits qux {} }");
collection.addSchemaFromString("schema qux { document qux inherits foo {} }");
assertEquals(collection.getParsedSchemas().size(), 3);
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.resolveInternalConnections());
- System.err.println("ex: "+ex.getMessage());
+ collection.resolveInternalConnections());
+ System.err.println("ex: " + ex.getMessage());
assertTrue(ex.getMessage().startsWith("Inheritance/reference cycle for documents: "));
}
@Test
- public void can_detect_missing_doc() throws Exception {
+ void can_detect_missing_doc() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromString("schema foo { document foo inherits bar {} }");
collection.addSchemaFromString("schema qux { document qux inherits foo {} }");
assertEquals(collection.getParsedSchemas().size(), 2);
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.resolveInternalConnections());
+ collection.resolveInternalConnections());
assertEquals("document foo inherits from unavailable document bar", ex.getMessage());
}
@Test
- public void can_detect_document_reference_cycle() throws Exception {
+ void can_detect_document_reference_cycle() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromString("schema foo { document foo { field oneref type reference<bar> {} } }");
collection.addSchemaFromString("schema bar { document bar { field tworef type reference<foo> {} } }");
assertEquals(collection.getParsedSchemas().size(), 2);
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.resolveInternalConnections());
- System.err.println("ex: "+ex.getMessage());
+ collection.resolveInternalConnections());
+ System.err.println("ex: " + ex.getMessage());
assertTrue(ex.getMessage().startsWith("Inheritance/reference cycle for documents: "));
}
@Test
- public void can_detect_cycles_with_reference() throws Exception {
+ void can_detect_cycles_with_reference() throws Exception {
var collection = new IntermediateCollection();
collection.addSchemaFromString("schema foo { document foodoc inherits bardoc {} }");
collection.addSchemaFromString("schema bar { document bardoc { field myref type reference<qux> { } } }");
collection.addSchemaFromString("schema qux inherits foo { document qux inherits foodoc {} }");
assertEquals(collection.getParsedSchemas().size(), 3);
var ex = assertThrows(IllegalArgumentException.class, () ->
- collection.resolveInternalConnections());
- System.err.println("ex: "+ex.getMessage());
+ collection.resolveInternalConnections());
+ System.err.println("ex: " + ex.getMessage());
assertTrue(ex.getMessage().startsWith("Inheritance/reference cycle for documents: "));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/parser/ParsedDocumentTestCase.java b/config-model/src/test/java/com/yahoo/schema/parser/ParsedDocumentTestCase.java
index 9245b64b09e..a594f9ae535 100644
--- a/config-model/src/test/java/com/yahoo/schema/parser/ParsedDocumentTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/parser/ParsedDocumentTestCase.java
@@ -1,9 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.parser;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* @author arnej
@@ -11,7 +12,7 @@ import static org.junit.Assert.assertThrows;
public class ParsedDocumentTestCase {
@Test
- public void fields_can_be_added_once() throws Exception {
+ void fields_can_be_added_once() throws Exception {
var doc = new ParsedDocument("foo");
var stringType = ParsedType.fromName("string");
doc.addField(new ParsedField("bar1", stringType));
@@ -19,11 +20,11 @@ public class ParsedDocumentTestCase {
doc.addField(new ParsedField("bar2", stringType));
doc.addField(new ParsedField("bar3", stringType));
var e = assertThrows(IllegalArgumentException.class, () ->
- doc.addField(new ParsedField("zap", stringType)));
- System.err.println("As expected: "+e);
+ doc.addField(new ParsedField("zap", stringType)));
+ System.err.println("As expected: " + e);
assertEquals("document 'foo' error: Duplicate (case insensitively) field 'zap' in document type 'foo'", e.getMessage());
e = assertThrows(IllegalArgumentException.class, () ->
- doc.addField(new ParsedField("ZAP", stringType)));
+ doc.addField(new ParsedField("ZAP", stringType)));
assertEquals("document 'foo' error: Duplicate (case insensitively) field 'ZAP' in document type 'foo'", e.getMessage());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/parser/SchemaParserTestCase.java b/config-model/src/test/java/com/yahoo/schema/parser/SchemaParserTestCase.java
index 77d1b55019d..150c237bbba 100644
--- a/config-model/src/test/java/com/yahoo/schema/parser/SchemaParserTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/parser/SchemaParserTestCase.java
@@ -8,12 +8,9 @@ import static com.yahoo.config.model.test.TestUtil.joinLines;
import java.io.File;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertThrows;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author arnej
@@ -38,12 +35,12 @@ public class SchemaParserTestCase {
}
@Test
- public void minimal_schema_can_be_parsed() throws Exception {
+ void minimal_schema_can_be_parsed() throws Exception {
String input = joinLines
- ("schema foo {",
- " document foo {",
- " }",
- "}");
+ ("schema foo {",
+ " document foo {",
+ " }",
+ "}");
ParsedSchema schema = parseString(input);
assertEquals("foo", schema.name());
assertTrue(schema.hasDocument());
@@ -51,10 +48,10 @@ public class SchemaParserTestCase {
}
@Test
- public void document_only_can_be_parsed() throws Exception {
+ void document_only_can_be_parsed() throws Exception {
String input = joinLines
- ("document bar {",
- "}");
+ ("document bar {",
+ "}");
ParsedSchema schema = parseString(input);
assertEquals("bar", schema.name());
assertTrue(schema.hasDocument());
@@ -62,28 +59,28 @@ public class SchemaParserTestCase {
}
@Test
- public void multiple_documents_disallowed() {
+ void multiple_documents_disallowed() {
String input = joinLines
("schema foo {",
- " document foo {",
- " }",
- " document foo2 {",
- " }",
- "}");
+ " document foo {",
+ " }",
+ " document foo2 {",
+ " }",
+ "}");
var e = assertThrows(IllegalArgumentException.class, () -> parseString(input));
assertEquals("schema 'foo' error: already has document 'foo' so cannot add document 'foo2'", e.getMessage());
}
@Test
- public void backwards_path_is_disallowed() {
+ void backwards_path_is_disallowed() {
assertEquals("'..' is not allowed in path",
- assertThrows(IllegalArgumentException.class,
- () -> parseString("schema foo {\n" +
- " constant my_constant_tensor {\n" +
- " file: foo/../bar\n" +
- " type: tensor<float>(x{},y{})\n" +
- " }\n" +
- "}\n")).getMessage());
+ assertThrows(IllegalArgumentException.class,
+ () -> parseString("schema foo {\n" +
+ " constant my_constant_tensor {\n" +
+ " file: foo/../bar\n" +
+ " type: tensor<float>(x{},y{})\n" +
+ " }\n" +
+ "}\n")).getMessage());
}
void checkFileParses(String fileName) throws Exception {
@@ -95,7 +92,7 @@ public class SchemaParserTestCase {
// TODO: Many (all)? of the files below are parsed from other tests and can be removed from here
@Test
- public void parse_various_old_sdfiles() throws Exception {
+ void parse_various_old_sdfiles() throws Exception {
checkFileParses("src/test/cfg/search/data/travel/schemas/TTData.sd");
checkFileParses("src/test/cfg/search/data/travel/schemas/TTEdge.sd");
checkFileParses("src/test/cfg/search/data/travel/schemas/TTPOI.sd");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java b/config-model/src/test/java/com/yahoo/schema/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java
index 0d64dd5c953..fe7edf5e433 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java
@@ -17,11 +17,11 @@ import com.yahoo.schema.document.SDField;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author bjorncs
@@ -33,7 +33,7 @@ public class AddAttributeTransformToSummaryOfImportedFieldsTest {
private static final String SUMMARY_NAME = "mysummary";
@Test
- public void attribute_summary_transform_applied_to_summary_field_of_imported_field() {
+ void attribute_summary_transform_applied_to_summary_field_of_imported_field() {
Schema schema = createSearchWithDocument(DOCUMENT_NAME);
schema.setImportedFields(createSingleImportedField(IMPORTED_FIELD_NAME));
schema.addSummary(createDocumentSummary(IMPORTED_FIELD_NAME, schema));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AdjustPositionSummaryFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/AdjustPositionSummaryFieldsTestCase.java
index 103d08b39a8..06d6e347f29 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AdjustPositionSummaryFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AdjustPositionSummaryFieldsTestCase.java
@@ -7,19 +7,14 @@ import com.yahoo.schema.Schema;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
-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.jupiter.api.Assertions.*;
public class AdjustPositionSummaryFieldsTestCase {
@Test
- public void test_pos_summary() {
+ void test_pos_summary() {
SearchModel model = new SearchModel(false);
model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
model.resolve();
@@ -29,7 +24,7 @@ public class AdjustPositionSummaryFieldsTestCase {
}
@Test
- public void test_imported_pos_summary() {
+ void test_imported_pos_summary() {
SearchModel model = new SearchModel();
model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
model.resolve();
@@ -39,7 +34,7 @@ public class AdjustPositionSummaryFieldsTestCase {
}
@Test
- public void test_imported_pos_summary_bad_source() {
+ void test_imported_pos_summary_bad_source() {
SearchModel model = new SearchModel();
model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
model.resolve();
@@ -50,7 +45,7 @@ public class AdjustPositionSummaryFieldsTestCase {
}
@Test
- public void test_imported_pos_summary_bad_datatype() {
+ void test_imported_pos_summary_bad_datatype() {
SearchModel model = new SearchModel();
model.addSummaryField("my_pos", DataType.getArray(PositionDataType.INSTANCE), null, "pos");
model.resolve();
@@ -60,7 +55,7 @@ public class AdjustPositionSummaryFieldsTestCase {
}
@Test
- public void test_pos_summary_no_attr_no_rename() {
+ void test_pos_summary_no_attr_no_rename() {
SearchModel model = new SearchModel(false, false, false);
model.addSummaryField("pos", PositionDataType.INSTANCE, null, "pos");
model.resolve();
@@ -70,14 +65,14 @@ public class AdjustPositionSummaryFieldsTestCase {
}
@Test
- public void test_pos_default_summary_no_attr_no_rename() {
+ void test_pos_default_summary_no_attr_no_rename() {
SearchModel model = new SearchModel(false, false, false);
model.resolve();
assertNull(model.childSchema.getSummary("default")); // ImplicitSummaries processing not run in this test
}
@Test
- public void test_pos_summary_no_rename() {
+ void test_pos_summary_no_rename() {
SearchModel model = new SearchModel(false, true, false);
model.addSummaryField("pos", PositionDataType.INSTANCE, null, "pos");
model.resolve();
@@ -86,79 +81,82 @@ public class AdjustPositionSummaryFieldsTestCase {
model.assertSummaryField("pos.distance", DataType.INT, SummaryTransform.DISTANCE, "pos_zcurve");
}
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void test_pos_summary_no_attr() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'");
- SearchModel model = new SearchModel(false, false, false);
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
- model.resolve();
+ void test_pos_summary_no_attr() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel(false, false, false);
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'"));
}
@Test
- public void test_pos_summary_bad_attr() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'");
- SearchModel model = new SearchModel(false, false, true);
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
- model.resolve();
+ void test_pos_summary_bad_attr() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel(false, false, true);
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, "pos");
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos': No position attribute 'pos_zcurve'"));
}
@Test
- public void test_imported_pos_summary_no_attr() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', import field 'my_pos_zcurve': "
- + "Field 'pos_zcurve' via reference field 'ref': Not found");
- SearchModel model = new SearchModel(true, false, false);
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
- model.resolve();
+ void test_imported_pos_summary_no_attr() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel(true, false, false);
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_pos_zcurve': "
+ + "Field 'pos_zcurve' via reference field 'ref': Not found"));
}
@Test
- public void test_imported_pos_summary_bad_attr() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos': "
- + "No position attribute 'my_pos_zcurve'");
- SearchModel model = new SearchModel(true, false, true);
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
- model.resolve();
+ void test_imported_pos_summary_bad_attr() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel(true, false, true);
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos': "
+ + "No position attribute 'my_pos_zcurve'"));
}
@Test
- public void test_my_pos_position_summary_bad_datatype() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': "
- + "exists with type 'datatype string (code: 2)', should be of type 'datatype Array<string> (code: -1486737430)");
- SearchModel model = new SearchModel();
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
- model.addSummaryField("my_pos.position", DataType.STRING, null, "pos");
- model.resolve();
+ void test_my_pos_position_summary_bad_datatype() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel();
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
+ model.addSummaryField("my_pos.position", DataType.STRING, null, "pos");
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos.position': "
+ + "exists with type 'datatype string (code: 2)', should be of type 'datatype Array<string> (code: -1486737430)"));
}
@Test
- public void test_my_pos_position_summary_bad_transform() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': "
- + "has summary transform 'none', should have transform 'positions'");
- SearchModel model = new SearchModel();
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
- model.addSummaryField("my_pos.position", DataType.getArray(DataType.STRING), null, "pos");
- model.resolve();
+ void test_my_pos_position_summary_bad_transform() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel();
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
+ model.addSummaryField("my_pos.position", DataType.getArray(DataType.STRING), null, "pos");
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos.position': "
+ + "has summary transform 'none', should have transform 'positions'"));
}
@Test
- public void test_my_pos_position_summary_bad_source() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', field 'my_pos.position': "
- + "has source '[source field 'pos']', should have source 'source field 'my_pos_zcurve''");
- SearchModel model = new SearchModel();
- model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
- model.addSummaryField("my_pos.position", DataType.getArray(DataType.STRING), SummaryTransform.POSITIONS, "pos");
- model.resolve();
+ void test_my_pos_position_summary_bad_source() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ SearchModel model = new SearchModel();
+ model.addSummaryField("my_pos", PositionDataType.INSTANCE, null, null);
+ model.addSummaryField("my_pos.position", DataType.getArray(DataType.STRING), SummaryTransform.POSITIONS, "pos");
+ model.resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', field 'my_pos.position': "
+ + "has source '[source field 'pos']', should have source 'source field 'my_pos_zcurve''"));
}
static class SearchModel extends ParentChildSearchModel {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AssertIndexingScript.java b/config-model/src/test/java/com/yahoo/schema/processing/AssertIndexingScript.java
index 82650598f29..f9c1e992347 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AssertIndexingScript.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AssertIndexingScript.java
@@ -9,8 +9,8 @@ import com.yahoo.vespa.indexinglanguage.parser.ParseException;
import java.util.LinkedList;
import java.util.List;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author Simon Thoresen Hult
@@ -36,8 +36,8 @@ public abstract class AssertIndexingScript {
}
for (Expression actualExp : actual) {
String str = actualExp.toString();
- assertTrue("Unexpected: " + str, parsedExpected.remove(str));
+ assertTrue(parsedExpected.remove(str), "Unexpected: " + str);
}
- assertTrue("Missing: " + parsedExpected.toString(), parsedExpected.isEmpty());
+ assertTrue(parsedExpected.isEmpty(), "Missing: " + parsedExpected.toString());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AssertSearchBuilder.java b/config-model/src/test/java/com/yahoo/schema/processing/AssertSearchBuilder.java
index 0b4d7c3a2b6..12da3f0797b 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AssertSearchBuilder.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AssertSearchBuilder.java
@@ -6,7 +6,7 @@ import com.yahoo.schema.parser.ParseException;
import java.io.IOException;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AttributesExactMatchTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/AttributesExactMatchTestCase.java
index 40ebe458c74..a01aa11264b 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AttributesExactMatchTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AttributesExactMatchTestCase.java
@@ -6,12 +6,13 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.MatchType;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
/**
* Attributes should be implicitly exact-match in some cases
* @author vegardh
@@ -19,7 +20,7 @@ import static org.junit.Assert.assertFalse;
*/
public class AttributesExactMatchTestCase extends AbstractSchemaTestCase {
@Test
- public void testAttributesExactMatch() throws IOException, ParseException {
+ void testAttributesExactMatch() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/attributesexactmatch.sd");
assertEquals(schema.getConcreteField("color").getMatching().getType(), MatchType.EXACT);
assertEquals(schema.getConcreteField("artist").getMatching().getType(), MatchType.WORD);
@@ -28,12 +29,12 @@ public class AttributesExactMatchTestCase extends AbstractSchemaTestCase {
assertEquals(schema.getConcreteField("saxophonist_arr").getMatching().getType(), MatchType.WORD);
assertEquals(schema.getConcreteField("flutist").getMatching().getType(), MatchType.TEXT);
- assertFalse(schema.getConcreteField("genre").getMatching().getType().equals(MatchType.EXACT));
- assertFalse(schema.getConcreteField("title").getMatching().getType().equals(MatchType.EXACT));
- assertFalse(schema.getConcreteField("trumpetist").getMatching().getType().equals(MatchType.EXACT));
- assertFalse(schema.getConcreteField("genre").getMatching().getType().equals(MatchType.WORD));
- assertFalse(schema.getConcreteField("title").getMatching().getType().equals(MatchType.WORD));
- assertFalse(schema.getConcreteField("trumpetist").getMatching().getType().equals(MatchType.WORD));
+ assertNotEquals(schema.getConcreteField("genre").getMatching().getType(), MatchType.EXACT);
+ assertNotEquals(schema.getConcreteField("title").getMatching().getType(), MatchType.EXACT);
+ assertNotEquals(schema.getConcreteField("trumpetist").getMatching().getType(), MatchType.EXACT);
+ assertNotEquals(schema.getConcreteField("genre").getMatching().getType(), MatchType.WORD);
+ assertNotEquals(schema.getConcreteField("title").getMatching().getType(), MatchType.WORD);
+ assertNotEquals(schema.getConcreteField("trumpetist").getMatching().getType(), MatchType.WORD);
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/BoldingTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/BoldingTestCase.java
index c37bc8085c7..fe38ea1f1b1 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/BoldingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/BoldingTestCase.java
@@ -4,10 +4,10 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-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 bratseth
@@ -29,13 +29,13 @@ public class BoldingTestCase extends AbstractSchemaTestCase {
"}\n";
@Test
- public void testBoldOnNonString() throws ParseException {
+ void testBoldOnNonString() throws ParseException {
try {
ApplicationBuilder.createFromString(boldonnonstring);
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("'bolding: on' for non-text field 'year4' (datatype int (code: 0)) is not allowed",
- e.getMessage());
+ e.getMessage());
}
}
@@ -50,13 +50,13 @@ public class BoldingTestCase extends AbstractSchemaTestCase {
"}\n";
@Test
- public void testBoldOnArray() throws ParseException {
+ void testBoldOnArray() throws ParseException {
try {
ApplicationBuilder.createFromString(boldonarray);
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("'bolding: on' for non-text field 'myarray' (datatype Array<string> (code: -1486737430)) is not allowed",
- e.getMessage());
+ e.getMessage());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/BoolAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/BoolAttributeValidatorTestCase.java
index 287cc6559d1..f19b1f43115 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/BoolAttributeValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/BoolAttributeValidatorTestCase.java
@@ -2,12 +2,12 @@
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.schema.ApplicationBuilder.createFromString;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author geirst
@@ -15,19 +15,19 @@ import static org.junit.Assert.fail;
public class BoolAttributeValidatorTestCase {
@Test
- public void array_of_bool_attribute_is_not_supported() throws ParseException {
+ void array_of_bool_attribute_is_not_supported() throws ParseException {
try {
createFromString(getSd("field b type array<bool> { indexing: attribute }"));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'b': Only single value bool attribute fields are supported",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void weigtedset_of_bool_attribute_is_not_supported() throws ParseException {
+ void weigtedset_of_bool_attribute_is_not_supported() throws ParseException {
try {
createFromString(getSd("field b type weightedset<bool> { indexing: attribute }"));
fail("Expected exception");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/DictionaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/DictionaryTestCase.java
index 45a546259ae..ef1716c80e6 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/DictionaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/DictionaryTestCase.java
@@ -11,11 +11,9 @@ import com.yahoo.schema.document.Dictionary;
import com.yahoo.schema.document.ImmutableSDField;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.config.search.AttributesConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test configuration of dictionary control.
@@ -33,19 +31,20 @@ public class DictionaryTestCase {
ApplicationBuilder sb = ApplicationBuilder.createFromString(def);
return sb.getSchema();
}
+
@Test
- public void testDefaultDictionarySettings() throws ParseException {
+ void testDefaultDictionarySettings() throws ParseException {
String def = TestUtil.joinLines(
- "search test {",
- " document test {",
- " field s1 type string {",
- " indexing: attribute | summary",
- " }",
- " field n1 type int {",
- " indexing: summary | attribute",
- " }",
- " }",
- "}");
+ "search test {",
+ " document test {",
+ " field s1 type string {",
+ " indexing: attribute | summary",
+ " }",
+ " field n1 type int {",
+ " indexing: summary | attribute",
+ " }",
+ " }",
+ "}");
Schema schema = createSearch(def);
assertNull(schema.getAttribute("s1").getDictionary());
assertNull(schema.getAttribute("n1").getDictionary());
@@ -103,64 +102,75 @@ public class DictionaryTestCase {
}
@Test
- public void testCasedBtreeSettings() throws ParseException {
+ void testCasedBtreeSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.BTREE, "int", "dictionary:cased");
}
@Test
- public void testNumericBtreeSettings() throws ParseException {
+ void testNumericBtreeSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.BTREE, "int", "dictionary:btree");
}
+
@Test
- public void testNumericHashSettings() throws ParseException {
+ void testNumericHashSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.HASH, "int", "dictionary:hash");
}
+
@Test
- public void testNumericBtreeAndHashSettings() throws ParseException {
+ void testNumericBtreeAndHashSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.BTREE_AND_HASH, "int", "dictionary:btree", "dictionary:hash");
}
+
@Test
- public void testNumericArrayBtreeAndHashSettings() throws ParseException {
+ void testNumericArrayBtreeAndHashSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.BTREE_AND_HASH, "array<int>", "dictionary:btree", "dictionary:hash");
}
+
@Test
- public void testNumericWSetBtreeAndHashSettings() throws ParseException {
+ void testNumericWSetBtreeAndHashSettings() throws ParseException {
verifyDictionaryControl(Dictionary.Type.BTREE_AND_HASH, "weightedset<int>", "dictionary:btree", "dictionary:hash");
}
+
@Test
- public void testStringBtreeSettings() throws ParseException {
+ void testStringBtreeSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.BTREE, Case.UNCASED, Case.UNCASED, "dictionary:btree");
}
+
@Test
- public void testStringBtreeUnCasedSettings() throws ParseException {
+ void testStringBtreeUnCasedSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.BTREE, Case.UNCASED, Case.UNCASED, "dictionary { btree\nuncased\n}");
}
+
@Test
- public void testStringBtreeCasedSettings() throws ParseException {
+ void testStringBtreeCasedSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.BTREE, Case.CASED, Case.CASED, "dictionary { btree\ncased\n}", "match:cased");
}
+
@Test
- public void testStringHashSettings() throws ParseException {
+ void testStringHashSettings() throws ParseException {
try {
verifyStringDictionaryControl(Dictionary.Type.HASH, Case.UNCASED, Case.UNCASED, "dictionary:hash");
} catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'n1': hash dictionary require cased match", e.getMessage());
}
}
+
@Test
- public void testStringHashUnCasedSettings() throws ParseException {
+ void testStringHashUnCasedSettings() throws ParseException {
try {
verifyStringDictionaryControl(Dictionary.Type.HASH, Case.UNCASED, Case.UNCASED, "dictionary { hash\nuncased\n}");
} catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'n1': hash dictionary require cased match", e.getMessage());
}
}
+
@Test
- public void testStringHashBothCasedSettings() throws ParseException {
+ void testStringHashBothCasedSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.HASH, Case.CASED, Case.CASED, "dictionary { hash\ncased\n}", "match:cased");
}
+
@Test
- public void testStringHashCasedSettings() throws ParseException {
+ void testStringHashCasedSettings() throws ParseException {
try {
verifyStringDictionaryControl(Dictionary.Type.HASH, Case.CASED, Case.CASED, "dictionary { hash\ncased\n}");
fail();
@@ -168,24 +178,28 @@ public class DictionaryTestCase {
assertEquals("For schema 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage());
}
}
+
@Test
- public void testStringBtreeHashSettings() throws ParseException {
+ void testStringBtreeHashSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.BTREE_AND_HASH, Case.UNCASED, Case.UNCASED, "dictionary{hash\nbtree\n}");
}
+
@Test
- public void testStringBtreeHashUnCasedSettings() throws ParseException {
+ void testStringBtreeHashUnCasedSettings() throws ParseException {
verifyStringDictionaryControl(Dictionary.Type.BTREE_AND_HASH, Case.UNCASED, Case.UNCASED, "dictionary { hash\nbtree\nuncased\n}");
}
+
@Test
- public void testStringBtreeHashCasedSettings() throws ParseException {
+ void testStringBtreeHashCasedSettings() throws ParseException {
try {
verifyStringDictionaryControl(Dictionary.Type.BTREE_AND_HASH, Case.CASED, Case.CASED, "dictionary { btree\nhash\ncased\n}");
} catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'n1': Dictionary casing 'CASED' does not match field match casing 'UNCASED'", e.getMessage());
}
}
+
@Test
- public void testNonNumericFieldsFailsDictionaryControl() throws ParseException {
+ void testNonNumericFieldsFailsDictionaryControl() throws ParseException {
String def = TestUtil.joinLines(
"schema test {",
" document test {",
@@ -202,8 +216,9 @@ public class DictionaryTestCase {
assertEquals("For schema 'test', field 'n1': You can only specify 'dictionary:' for numeric or string fields", e.getMessage());
}
}
+
@Test
- public void testNonFastSearchNumericFieldsFailsDictionaryControl() throws ParseException {
+ void testNonFastSearchNumericFieldsFailsDictionaryControl() throws ParseException {
String def = TestUtil.joinLines(
"schema test {",
" document test {",
@@ -222,7 +237,7 @@ public class DictionaryTestCase {
}
@Test
- public void testCasingForNonFastSearch() throws ParseException {
+ void testCasingForNonFastSearch() throws ParseException {
String def = TestUtil.joinLines(
"schema test {",
" document test {",
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
index 64b0a437b1d..4efd20a06f1 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java
@@ -4,41 +4,53 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.RankProfileRegistry;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* @author lesters
*/
public class DisallowComplexMapAndWsetKeyTypesTestCase {
- @Test(expected = IllegalArgumentException.class)
- public void requireThatComplexTypesForMapKeysFail() throws ParseException {
- testFieldType("map<mystruct,string>");
+ @Test
+ void requireThatComplexTypesForMapKeysFail() throws ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ testFieldType("map<mystruct,string>");
+ });
}
- @Test(expected = IllegalArgumentException.class)
- public void requireThatComplexTypesForWsetFail() throws ParseException {
- testFieldType("weightedset<mystruct>");
+ @Test
+ void requireThatComplexTypesForWsetFail() throws ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ testFieldType("weightedset<mystruct>");
+ });
}
- @Test(expected = IllegalArgumentException.class)
- public void requireThatNestedComplexTypesForMapFail() throws ParseException {
- testFieldType("array<map<mystruct,string>>");
+ @Test
+ void requireThatNestedComplexTypesForMapFail() throws ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ testFieldType("array<map<mystruct,string>>");
+ });
}
@Test
- public void requireThatNestedComplexValuesForMapSucceed() throws ParseException {
+ void requireThatNestedComplexValuesForMapSucceed() throws ParseException {
testFieldType("array<map<string,mystruct>>");
}
- @Test(expected = IllegalArgumentException.class)
- public void requireThatNestedComplexTypesForWsetFail() throws ParseException {
- testFieldType("array<weightedset<mystruct>>");
+ @Test
+ void requireThatNestedComplexTypesForWsetFail() throws ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ testFieldType("array<weightedset<mystruct>>");
+ });
}
- @Test(expected = IllegalArgumentException.class)
- public void requireThatDeepNestedComplexTypesForMapFail() throws ParseException {
- testFieldType("map<string,map<mystruct,string>>");
+ @Test
+ void requireThatDeepNestedComplexTypesForMapFail() throws ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ testFieldType("map<string,map<mystruct,string>>");
+ });
}
private void testFieldType(String fieldType) throws ParseException {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java
index b249b407c7b..ebf79a4a7d5 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java
@@ -5,57 +5,54 @@ import com.yahoo.config.model.test.TestUtil;
import com.yahoo.schema.RankProfileRegistry;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author bjorncs
*/
public class FastAccessValidatorTest {
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException {
- ApplicationBuilder builder = new ApplicationBuilder(new RankProfileRegistry());
- builder.addSchema(
- TestUtil.joinLines(
- "schema parent {",
- " document parent {",
- " field int_field type int { indexing: attribute }",
- " }",
- "}"));
- builder.addSchema(
- TestUtil.joinLines(
- "schema test {",
- " document test { ",
- " field int_attribute type int { ",
- " indexing: attribute ",
- " attribute: fast-access",
- " }",
- " field predicate_attribute type predicate {",
- " indexing: attribute ",
- " attribute: fast-access",
- " }",
- " field tensor_attribute type tensor(x[5]) {",
- " indexing: attribute ",
- " attribute: fast-access",
- " }",
- " field reference_attribute type reference<parent> {",
- " indexing: attribute ",
- " attribute: fast-access",
- " }",
- " }",
- "}"));
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "For schema 'test': The following attributes have a type that is incompatible " +
- "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " +
- "Predicate, tensor and reference attributes are incompatible with fast-access.");
- builder.build(true);
+ void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ ApplicationBuilder builder = new ApplicationBuilder(new RankProfileRegistry());
+ builder.addSchema(
+ TestUtil.joinLines(
+ "schema parent {",
+ " document parent {",
+ " field int_field type int { indexing: attribute }",
+ " }",
+ "}"));
+ builder.addSchema(
+ TestUtil.joinLines(
+ "schema test {",
+ " document test { ",
+ " field int_attribute type int { ",
+ " indexing: attribute ",
+ " attribute: fast-access",
+ " }",
+ " field predicate_attribute type predicate {",
+ " indexing: attribute ",
+ " attribute: fast-access",
+ " }",
+ " field tensor_attribute type tensor(x[5]) {",
+ " indexing: attribute ",
+ " attribute: fast-access",
+ " }",
+ " field reference_attribute type reference<parent> {",
+ " indexing: attribute ",
+ " attribute: fast-access",
+ " }",
+ " }",
+ "}"));
+ builder.build(true);
+ });
+ assertTrue(exception.getMessage().contains("For schema 'test': The following attributes have a type that is incompatible " +
+ "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " +
+ "Predicate, tensor and reference attributes are incompatible with fast-access."));
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
index 594124c9500..c758d49f79f 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
@@ -7,17 +7,17 @@ import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.derived.DerivedConfiguration;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
@Test
- public void testRequireThatExtraFieldsAreIncluded() throws IOException, ParseException {
+ void testRequireThatExtraFieldsAreIncluded() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/extrafield.sd");
assertNotNull(schema);
@@ -29,7 +29,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testRequireThatSummaryFieldsAreIncluded() throws IOException, ParseException {
+ void testRequireThatSummaryFieldsAreIncluded() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/summaryfield.sd");
assertNotNull(schema);
@@ -44,7 +44,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testRequireThatBoldedSummaryFieldsAreIncluded() throws IOException, ParseException {
+ void testRequireThatBoldedSummaryFieldsAreIncluded() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/boldedsummaryfields.sd");
assertNotNull(schema);
@@ -58,7 +58,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testRequireThatUntransformedSummaryFieldsAreIgnored() throws IOException, ParseException {
+ void testRequireThatUntransformedSummaryFieldsAreIgnored() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/untransformedsummaryfields.sd");
assertNotNull(schema);
@@ -71,7 +71,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testRequireThatDynamicSummaryFieldsAreIgnored() throws IOException, ParseException {
+ void testRequireThatDynamicSummaryFieldsAreIgnored() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/dynamicsummaryfields.sd");
assertNotNull(schema);
@@ -83,7 +83,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException {
+ void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException {
ApplicationBuilder sb = new ApplicationBuilder();
sb.addSchemaFile("src/test/examples/nextgen/simple.sd");
sb.build(true);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
index 111ed266d74..243ec0243c8 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
@@ -8,14 +8,15 @@ import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+
public class ImplicitStructTypesTestCase extends AbstractSchemaTestCase {
@Test
- public void testRequireThatImplicitStructsAreCreated() throws IOException, ParseException {
+ void testRequireThatImplicitStructsAreCreated() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/toggleon.sd");
assertNotNull(schema);
@@ -23,8 +24,9 @@ public class ImplicitStructTypesTestCase extends AbstractSchemaTestCase {
assertNotNull(docType);
assertStruct(docType, PositionDataType.INSTANCE);
}
+
@Test
- public void testRequireThatImplicitStructsAreUsed() throws IOException, ParseException {
+ void testRequireThatImplicitStructsAreUsed() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/nextgen/implicitstructtypes.sd");
assertNotNull(schema);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummariesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummariesTestCase.java
index 50deb5d5b42..37bc064c19e 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummariesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummariesTestCase.java
@@ -5,7 +5,7 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.ArrayList;
@@ -15,9 +15,7 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author Simon Thoresen Hult
@@ -25,7 +23,7 @@ import static org.junit.Assert.assertTrue;
public class ImplicitSummariesTestCase {
@Test
- public void requireThatSummaryFromAttributeDoesNotWarn() throws IOException, ParseException {
+ void requireThatSummaryFromAttributeDoesNotWarn() throws IOException, ParseException {
LogHandler log = new LogHandler();
Logger.getLogger("").addHandler(log);
@@ -59,19 +57,19 @@ public class ImplicitSummariesTestCase {
}
@Test
- public void attribute_combiner_transform_is_set_on_array_of_struct_with_only_struct_field_attributes() throws IOException, ParseException {
+ void attribute_combiner_transform_is_set_on_array_of_struct_with_only_struct_field_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/array_of_struct_attribute/test.sd");
assertEquals(SummaryTransform.ATTRIBUTECOMBINER, schema.getSummaryField("elem_array").getTransform());
}
@Test
- public void attribute_combiner_transform_is_set_on_map_of_struct_with_only_struct_field_attributes() throws IOException, ParseException {
+ void attribute_combiner_transform_is_set_on_map_of_struct_with_only_struct_field_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd");
assertEquals(SummaryTransform.ATTRIBUTECOMBINER, schema.getSummaryField("str_elem_map").getTransform());
}
@Test
- public void attribute_combiner_transform_is_not_set_when_map_of_struct_has_some_struct_field_attributes() throws IOException, ParseException {
+ void attribute_combiner_transform_is_not_set_when_map_of_struct_has_some_struct_field_attributes() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd");
assertEquals(SummaryTransform.NONE, schema.getSummaryField("int_elem_map").getTransform());
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummaryFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummaryFieldsTestCase.java
index f32c9079d36..bc7513b4662 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummaryFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSummaryFieldsTestCase.java
@@ -6,17 +6,17 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.documentmodel.DocumentSummary;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
public class ImplicitSummaryFieldsTestCase extends AbstractSchemaTestCase {
@Test
- public void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
+ void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/implicitsummaryfields.sd");
assertNotNull(schema);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsResolverTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsResolverTestCase.java
index 5baa64d06d4..853cb1d1a79 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsResolverTestCase.java
@@ -11,24 +11,15 @@ import com.yahoo.schema.document.ImportedFields;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporarySDField;
import com.yahoo.tensor.TensorType;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author geirst
*/
public class ImportedFieldsResolverTestCase {
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
private void resolve_imported_field(String fieldName, String targetFieldName) {
SearchModel model = new SearchModel();
model.addImportedField(fieldName, "ref", targetFieldName).resolve();
@@ -52,54 +43,57 @@ public class ImportedFieldsResolverTestCase {
}
@Test
- public void valid_imported_fields_are_resolved() {
+ void valid_imported_fields_are_resolved() {
resolve_imported_field("my_attribute_field", "attribute_field");
resolve_imported_field("my_tensor_field", "tensor_field");
resolve_imported_field("my_ancient_field", "ancient_field");
}
@Test
- public void resolver_fails_if_document_reference_is_not_found() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', import field 'my_attribute_field': "
- + "Reference field 'not_ref' not found");
- new SearchModel().addImportedField("my_attribute_field", "not_ref", "budget").resolve();
+ void resolver_fails_if_document_reference_is_not_found() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ new SearchModel().addImportedField("my_attribute_field", "not_ref", "budget").resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_attribute_field': "
+ + "Reference field 'not_ref' not found"));
}
@Test
- public void resolver_fails_if_referenced_field_is_not_found() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', import field 'my_attribute_field': "
- + "Field 'not_existing' via reference field 'ref': Not found");
- new SearchModel().addImportedField("my_attribute_field", "ref", "not_existing").resolve();
+ void resolver_fails_if_referenced_field_is_not_found() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ new SearchModel().addImportedField("my_attribute_field", "ref", "not_existing").resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_attribute_field': "
+ + "Field 'not_existing' via reference field 'ref': Not found"));
}
@Test
- public void resolver_fails_if_imported_field_is_not_an_attribute() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'child', import field 'my_not_attribute': "
- + "Field 'not_attribute' via reference field 'ref': Is not an attribute field. Only attribute fields supported");
- new SearchModel().addImportedField("my_not_attribute", "ref", "not_attribute").resolve();
+ void resolver_fails_if_imported_field_is_not_an_attribute() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ new SearchModel().addImportedField("my_not_attribute", "ref", "not_attribute").resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_not_attribute': "
+ + "Field 'not_attribute' via reference field 'ref': Is not an attribute field. Only attribute fields supported"));
}
@Test
- public void resolver_fails_if_imported_field_is_indexing() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "For schema 'child', import field 'my_attribute_and_index': " +
- "Field 'attribute_and_index' via reference field 'ref': Is an index field. Not supported");
- new SearchModel()
- .addImportedField("my_attribute_and_index", "ref", "attribute_and_index")
- .resolve();
+ void resolver_fails_if_imported_field_is_indexing() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ new SearchModel()
+ .addImportedField("my_attribute_and_index", "ref", "attribute_and_index")
+ .resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_attribute_and_index': " +
+ "Field 'attribute_and_index' via reference field 'ref': Is an index field. Not supported"));
}
@Test
- public void resolver_fails_if_imported_field_is_of_type_predicate() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "For schema 'child', import field 'my_predicate_field': " +
- "Field 'predicate_field' via reference field 'ref': Is of type 'predicate'. Not supported");
- new SearchModel().addImportedField("my_predicate_field", "ref", "predicate_field").resolve();
+ void resolver_fails_if_imported_field_is_of_type_predicate() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ new SearchModel().addImportedField("my_predicate_field", "ref", "predicate_field").resolve();
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_predicate_field': " +
+ "Field 'predicate_field' via reference field 'ref': Is of type 'predicate'. Not supported"));
}
static class SearchModel extends ParentChildSearchModel {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsTestCase.java
index ab702154527..6c23d1ecf91 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImportedFieldsTestCase.java
@@ -7,15 +7,10 @@ import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.document.ImportedComplexField;
import com.yahoo.schema.document.ImportedField;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author geirst
@@ -23,7 +18,7 @@ import static org.junit.Assert.assertTrue;
public class ImportedFieldsTestCase {
@Test
- public void fields_can_be_imported_from_referenced_document_types() throws ParseException {
+ void fields_can_be_imported_from_referenced_document_types() throws ParseException {
Schema schema = buildAdSearch(joinLines(
"search ad {",
" document ad {",
@@ -38,33 +33,31 @@ public class ImportedFieldsTestCase {
assertSearchContainsImportedField("my_name", "person_ref", "person", "name", schema);
}
- @SuppressWarnings("deprecation")
- @Rule
- public ExpectedException exception = ExpectedException.none();
-
@Test
- public void field_reference_spec_must_include_dot() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Illegal field reference spec 'campaignrefbudget': Does not include a single '.'");
- buildAdSearch(joinLines(
- "search ad {",
- " document ad {}",
- " import field campaignrefbudget as budget {}",
- "}"));
+ void field_reference_spec_must_include_dot() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ buildAdSearch(joinLines(
+ "search ad {",
+ " document ad {}",
+ " import field campaignrefbudget as budget {}",
+ "}"));
+ });
+ assertTrue(exception.getMessage().contains("Illegal field reference spec 'campaignrefbudget': Does not include a single '.'"));
}
@Test
- public void fail_duplicate_import() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'ad', import field as 'my_budget': Field already imported");
- Schema schema = buildAdSearch(joinLines(
- "schema ad {",
- " document ad {",
- " field campaign_ref type reference<campaign> { indexing: attribute }",
- " }",
- " import field campaign_ref.budget as my_budget {}",
- " import field campaign_ref.budget as my_budget {}",
- "}"));
+ void fail_duplicate_import() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ Schema schema = buildAdSearch(joinLines(
+ "schema ad {",
+ " document ad {",
+ " field campaign_ref type reference<campaign> { indexing: attribute }",
+ " }",
+ " import field campaign_ref.budget as my_budget {}",
+ " import field campaign_ref.budget as my_budget {}",
+ "}"));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'ad', import field as 'my_budget': Field already imported"));
}
private static Schema buildAdSearch(String sdContent) throws ParseException {
@@ -113,52 +106,57 @@ public class ImportedFieldsTestCase {
}
@Test
- public void check_struct_import() throws ParseException {
+ void check_struct_import() throws ParseException {
checkStructImport(new ParentStructSdBuilder());
checkStructImport(new ParentStructSdBuilder().elem_array_weight_attr(false).elem_map_value_weight_attr(false));
checkStructImport(new ParentStructSdBuilder().elem_array_name_attr(false).elem_map_value_name_attr(false));
}
@Test
- public void check_nested_struct_import() throws ParseException {
+ void check_nested_struct_import() throws ParseException {
checkNestedStructImport(new GrandParentStructSdBuilder());
checkNestedStructImport(new GrandParentStructSdBuilder().elem_array_weight_attr(false).elem_map_value_weight_attr(false));
checkNestedStructImport(new GrandParentStructSdBuilder().elem_array_name_attr(false).elem_map_value_name_attr(false));
}
@Test
- public void check_illegal_struct_import_missing_array_of_struct_attributes() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_elem_array': Field 'elem_array' via reference field 'parent_ref': Is not a struct containing an attribute field.");
- checkStructImport(new ParentStructSdBuilder().elem_array_name_attr(false).elem_array_weight_attr(false));
+ void check_illegal_struct_import_missing_array_of_struct_attributes() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkStructImport(new ParentStructSdBuilder().elem_array_name_attr(false).elem_array_weight_attr(false));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_elem_array': Field 'elem_array' via reference field 'parent_ref': Is not a struct containing an attribute field."));
}
@Test
- public void check_illegal_struct_import_missing_map_of_struct_key_attribute() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.key'): Field 'elem_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported");
- checkStructImport(new ParentStructSdBuilder().elem_map_key_attr(false));
+ void check_illegal_struct_import_missing_map_of_struct_key_attribute() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkStructImport(new ParentStructSdBuilder().elem_map_key_attr(false));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.key'): Field 'elem_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"));
}
@Test
- public void check_illegal_struct_import_missing_map_of_struct_value_attributes() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.value'): Field 'elem_map.value' via reference field 'parent_ref': Is not a struct containing an attribute field.");
- checkStructImport(new ParentStructSdBuilder().elem_map_value_name_attr(false).elem_map_value_weight_attr(false));
+ void check_illegal_struct_import_missing_map_of_struct_value_attributes() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkStructImport(new ParentStructSdBuilder().elem_map_value_name_attr(false).elem_map_value_weight_attr(false));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_elem_map' (nested to 'my_elem_map.value'): Field 'elem_map.value' via reference field 'parent_ref': Is not a struct containing an attribute field."));
}
@Test
- public void check_illegal_struct_import_missing_map_of_primitive_key_attribute() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.key'): Field 'str_int_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported");
- checkStructImport(new ParentStructSdBuilder().str_int_map_key_attr(false));
+ void check_illegal_struct_import_missing_map_of_primitive_key_attribute() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkStructImport(new ParentStructSdBuilder().str_int_map_key_attr(false));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.key'): Field 'str_int_map.key' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"));
}
@Test
- public void check_illegal_struct_import_missing_map_of_primitive_value_attribute() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.value'): Field 'str_int_map.value' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported");
- checkStructImport(new ParentStructSdBuilder().str_int_map_value_attr(false));
+ void check_illegal_struct_import_missing_map_of_primitive_value_attribute() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkStructImport(new ParentStructSdBuilder().str_int_map_value_attr(false));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_str_int_map' (nested to 'my_str_int_map.value'): Field 'str_int_map.value' via reference field 'parent_ref': Is not an attribute field. Only attribute fields supported"));
}
private static class NamedSdBuilder {
@@ -408,20 +406,21 @@ public class ImportedFieldsTestCase {
}
@Test
- public void check_pos_import() throws ParseException {
+ void check_pos_import() throws ParseException {
checkPosImport(new ParentPosSdBuilder(), new ChildPosSdBuilder());
}
@Test
- public void check_nested_pos_import() throws ParseException {
+ void check_nested_pos_import() throws ParseException {
checkNestedPosImport(new GrandParentPosSdBuilder(), new ChildPosSdBuilder());
}
@Test
- public void check_pos_import_after_pos_zcurve_import() throws ParseException {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("For schema 'child', import field 'my_pos_zcurve': Field 'pos_zcurve' via reference field 'parent_ref': Field already imported");
- checkPosImport(new ParentPosSdBuilder(), new ChildPosSdBuilder().import_pos_zcurve_before(true));
+ void check_pos_import_after_pos_zcurve_import() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ checkPosImport(new ParentPosSdBuilder(), new ChildPosSdBuilder().import_pos_zcurve_before(true));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'child', import field 'my_pos_zcurve': Field 'pos_zcurve' via reference field 'parent_ref': Field already imported"));
}
private static ImportedField getImportedField(String name, Schema schema) {
@@ -466,7 +465,7 @@ public class ImportedFieldsTestCase {
}
@Test
- public void field_with_struct_field_attributes_can_be_imported_from_parents_that_use_inheritance() throws ParseException {
+ void field_with_struct_field_attributes_can_be_imported_from_parents_that_use_inheritance() throws ParseException {
var builder = buildParentsUsingInheritance();
assertParentContainsEntriesAttributes(builder.getSchema("parent_a"));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java
index 71c79feedc1..893ee3b1ea4 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -14,32 +14,32 @@ import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuildFails;
public class IndexingInputsTestCase {
@Test
- public void requireThatExtraFieldInputExtraFieldThrows() throws IOException, ParseException {
+ void requireThatExtraFieldInputExtraFieldThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_extra_field_input_extra_field.sd",
- "For schema 'indexing_extra_field_input_extra_field', field 'bar': Indexing script refers " +
- "to field 'bar' which does not exist in document type " +
- "'indexing_extra_field_input_extra_field', and is not a mutable attribute.");
+ "For schema 'indexing_extra_field_input_extra_field', field 'bar': Indexing script refers " +
+ "to field 'bar' which does not exist in document type " +
+ "'indexing_extra_field_input_extra_field', and is not a mutable attribute.");
}
@Test
- public void requireThatExtraFieldInputImplicitThrows() throws IOException, ParseException {
+ void requireThatExtraFieldInputImplicitThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_extra_field_input_implicit.sd",
- "For schema 'indexing_extra_field_input_implicit', field 'foo': Indexing script refers to " +
- "field 'foo' which does not exist in document type 'indexing_extra_field_input_implicit', and is not a mutable attribute.");
+ "For schema 'indexing_extra_field_input_implicit', field 'foo': Indexing script refers to " +
+ "field 'foo' which does not exist in document type 'indexing_extra_field_input_implicit', and is not a mutable attribute.");
}
@Test
- public void requireThatExtraFieldInputNullThrows() throws IOException, ParseException {
+ void requireThatExtraFieldInputNullThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_extra_field_input_null.sd",
- "For schema 'indexing_extra_field_input_null', field 'foo': Indexing script refers to field " +
- "'foo' which does not exist in document type 'indexing_extra_field_input_null', and is not a mutable attribute.");
+ "For schema 'indexing_extra_field_input_null', field 'foo': Indexing script refers to field " +
+ "'foo' which does not exist in document type 'indexing_extra_field_input_null', and is not a mutable attribute.");
}
@Test
- public void requireThatExtraFieldInputSelfThrows() throws IOException, ParseException {
+ void requireThatExtraFieldInputSelfThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_extra_field_input_self.sd",
- "For schema 'indexing_extra_field_input_self', field 'foo': Indexing script refers to field " +
- "'foo' which does not exist in document type 'indexing_extra_field_input_self', and is not a mutable attribute.");
+ "For schema 'indexing_extra_field_input_self', field 'foo': Indexing script refers to field " +
+ "'foo' which does not exist in document type 'indexing_extra_field_input_self', and is not a mutable attribute.");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
index 687549f920e..e707d203381 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,16 +15,16 @@ import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuildFails;
public class IndexingOutputsTestCase {
@Test
- public void requireThatOutputOtherFieldThrows() throws IOException, ParseException {
+ void requireThatOutputOtherFieldThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_output_other_field.sd",
- "For schema 'indexing_output_other_field', field 'foo': Indexing expression 'index bar' " +
- "attempts to write to a field other than 'foo'.");
+ "For schema 'indexing_output_other_field', field 'foo': Indexing expression 'index bar' " +
+ "attempts to write to a field other than 'foo'.");
}
@Test
- public void requireThatOutputConflictThrows() throws IOException, ParseException {
+ void requireThatOutputConflictThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_output_conflict.sd",
- "For schema 'indexing_output_confict', field 'bar': For expression 'index bar': Attempting " +
- "to assign conflicting values to field 'bar'.");
+ "For schema 'indexing_output_confict', field 'bar': For expression 'index bar': Attempting " +
+ "to assign conflicting values to field 'bar'.");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
index 76cb6a5505c..54a50d2ce93 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
@@ -16,7 +16,7 @@ import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.OptionalDouble;
@@ -25,7 +25,7 @@ import java.util.OptionalLong;
import java.util.Set;
import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Simon Thoresen Hult
@@ -33,108 +33,108 @@ import static org.junit.Assert.assertEquals;
public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
@Test
- public void testSetLanguageRewriting() {
+ void testSetLanguageRewriting() {
assertIndexingScript("{ input test | set_language; }",
- createField("test", DataType.STRING, "{ set_language }"));
+ createField("test", DataType.STRING, "{ set_language }"));
}
@Test
- public void testSummaryRewriting() {
+ void testSummaryRewriting() {
assertIndexingScript("{ input test | summary test; }",
- createField("test", DataType.STRING, "{ summary }"));
+ createField("test", DataType.STRING, "{ summary }"));
}
@Test
- public void testDynamicSummaryRewriting() {
+ void testDynamicSummaryRewriting() {
SDField field = createField("test", DataType.STRING, "{ summary }");
field.addSummaryField(createDynamicSummaryField(field, "dyn"));
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | summary dyn; }", field);
}
@Test
- public void testSummaryRewritingWithIndexing() {
+ void testSummaryRewritingWithIndexing() {
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | summary test | index test; }",
- createField("test", DataType.STRING, "{ summary | index }"));
+ createField("test", DataType.STRING, "{ summary | index }"));
}
@Test
- public void testDynamicAndStaticSummariesRewritingWithIndexing() {
+ void testDynamicAndStaticSummariesRewritingWithIndexing() {
SDField field = createField("test", DataType.STRING, "{ summary | index }");
field.addSummaryField(createDynamicSummaryField(field, "dyn"));
field.addSummaryField(createStaticSummaryField(field, "test"));
field.addSummaryField(createStaticSummaryField(field, "other"));
field.addSummaryField(createDynamicSummaryField(field, "dyn2"));
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | summary dyn | summary dyn2 | summary other | " +
- "summary test | index test; }", field);
+ "summary test | index test; }", field);
}
@Test
- public void testIntSummaryRewriting() {
+ void testIntSummaryRewriting() {
assertIndexingScript("{ input test | summary test | attribute test; }",
- createField("test", DataType.INT, "{ summary | index }"));
+ createField("test", DataType.INT, "{ summary | index }"));
}
@Test
- public void testStringAttributeSummaryRewriting() {
+ void testStringAttributeSummaryRewriting() {
assertIndexingScript("{ input test | summary test | attribute test; }",
- createField("test", DataType.STRING, "{ summary | attribute }"));
+ createField("test", DataType.STRING, "{ summary | attribute }"));
}
@Test
- public void testMultiblockTokenize() {
+ void testMultiblockTokenize() {
SDField field = createField("test", DataType.STRING,
- "{ input test | tokenize | { summary test; }; }");
+ "{ input test | tokenize | { summary test; }; }");
assertIndexingScript("{ input test | tokenize | { summary test; }; }", field);
}
@Test
- public void requireThatOutputDefaultsToCurrentField() {
+ void requireThatOutputDefaultsToCurrentField() {
assertIndexingScript("{ input test | attribute test; }",
- createField("test", DataType.STRING, "{ attribute; }"));
+ createField("test", DataType.STRING, "{ attribute; }"));
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | index test; }",
- createField("test", DataType.STRING, "{ index; }"));
+ createField("test", DataType.STRING, "{ index; }"));
assertIndexingScript("{ input test | summary test; }",
- createField("test", DataType.STRING, "{ summary; }"));
+ createField("test", DataType.STRING, "{ summary; }"));
}
@Test
- public void testTokenizeComparisonDisregardsConfig() {
+ void testTokenizeComparisonDisregardsConfig() {
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | summary test | index test; }",
- createField("test", DataType.STRING, "{ summary | tokenize | index; }"));
+ createField("test", DataType.STRING, "{ summary | tokenize | index; }"));
}
@Test
- public void testDerivingFromSimple() throws Exception {
+ void testDerivingFromSimple() throws Exception {
assertIndexing(Arrays.asList("clear_state | guard { input access | attribute access; }",
- "clear_state | guard { input category | split \";\" | attribute category_arr; }",
- "clear_state | guard { input category | tokenize | index category; }",
- "clear_state | guard { input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }",
- "clear_state | guard { input categoriesagain_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categoriesagain; }",
- "clear_state | guard { input chatter | tokenize normalize stem:\"BEST\" | index chatter; }",
- "clear_state | guard { input description | tokenize normalize stem:\"BEST\" | summary description | summary dyndesc | index description; }",
- "clear_state | guard { input exactemento_src | lowercase | tokenize normalize stem:\"BEST\" | index exactemento | summary exactemento; }",
- "clear_state | guard { input longdesc | tokenize normalize stem:\"BEST\" | summary dyndesc2 | summary dynlong | summary longdesc | summary longstat; }",
- "clear_state | guard { input measurement | attribute measurement | summary measurement; }",
- "clear_state | guard { input measurement | to_array | attribute measurement_arr; }",
- "clear_state | guard { input popularity | attribute popularity; }",
- "clear_state | guard { input popularity * input measurement | attribute popsiness; }",
- "clear_state | guard { input smallattribute | attribute smallattribute; }",
- "clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }",
- "clear_state | guard { input title . \" \" . input category | tokenize | summary exact | index exact; }"),
- ApplicationBuilder.buildFromFile("src/test/examples/simple.sd"));
+ "clear_state | guard { input category | split \";\" | attribute category_arr; }",
+ "clear_state | guard { input category | tokenize | index category; }",
+ "clear_state | guard { input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }",
+ "clear_state | guard { input categoriesagain_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categoriesagain; }",
+ "clear_state | guard { input chatter | tokenize normalize stem:\"BEST\" | index chatter; }",
+ "clear_state | guard { input description | tokenize normalize stem:\"BEST\" | summary description | summary dyndesc | index description; }",
+ "clear_state | guard { input exactemento_src | lowercase | tokenize normalize stem:\"BEST\" | index exactemento | summary exactemento; }",
+ "clear_state | guard { input longdesc | tokenize normalize stem:\"BEST\" | summary dyndesc2 | summary dynlong | summary longdesc | summary longstat; }",
+ "clear_state | guard { input measurement | attribute measurement | summary measurement; }",
+ "clear_state | guard { input measurement | to_array | attribute measurement_arr; }",
+ "clear_state | guard { input popularity | attribute popularity; }",
+ "clear_state | guard { input popularity * input measurement | attribute popsiness; }",
+ "clear_state | guard { input smallattribute | attribute smallattribute; }",
+ "clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }",
+ "clear_state | guard { input title . \" \" . input category | tokenize | summary exact | index exact; }"),
+ ApplicationBuilder.buildFromFile("src/test/examples/simple.sd"));
}
@Test
- public void testIndexRewrite() throws Exception {
+ void testIndexRewrite() throws Exception {
assertIndexing(
Arrays.asList("clear_state | guard { input title_src | lowercase | normalize | " +
- " tokenize | index title; }",
- "clear_state | guard { input title_src | summary title_s; }"),
+ " tokenize | index title; }",
+ "clear_state | guard { input title_src | summary title_s; }"),
ApplicationBuilder.buildFromFile("src/test/examples/indexrewrite.sd"));
}
@Test
- public void requireThatPredicateFieldsGetOptimization() {
+ void requireThatPredicateFieldsGetOptimization() {
assertIndexingScript("{ 10 | set_var arity | { input test | optimize_predicate | attribute test; }; }",
createPredicateField(
"test", DataType.PREDICATE, "{ attribute; }", 10, OptionalLong.empty(), OptionalLong.empty()));
@@ -143,7 +143,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
"test", DataType.PREDICATE, "{ summary | attribute ; }", 10, OptionalLong.empty(), OptionalLong.empty()));
assertIndexingScript(
"{ 2 | set_var arity | 0L | set_var lower_bound | 1023L | set_var upper_bound | " +
- "{ input test | optimize_predicate | attribute test; }; }",
+ "{ input test | optimize_predicate | attribute test; }; }",
createPredicateField("test", DataType.PREDICATE, "{ attribute; }", 2, OptionalLong.of(0L), OptionalLong.of(1023L)));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
index 4da6880aa26..aa8a2922e8f 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
@@ -4,7 +4,7 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.derived.AbstractExportingTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;
@@ -18,59 +18,59 @@ import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuildFails;
public class IndexingValidationTestCase extends AbstractExportingTestCase {
@Test
- public void testAttributeChanged() throws IOException, ParseException {
+ void testAttributeChanged() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_attribute_changed.sd",
- "For schema 'indexing_attribute_changed', field 'foo': For expression 'attribute foo': " +
- "Attempting to assign conflicting values to field 'foo'.");
+ "For schema 'indexing_attribute_changed', field 'foo': For expression 'attribute foo': " +
+ "Attempting to assign conflicting values to field 'foo'.");
}
@Test
- public void testAttributeOther() throws IOException, ParseException {
+ void testAttributeOther() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_attribute_other.sd",
- "For schema 'indexing_attribute_other', field 'foo': Indexing expression 'attribute bar' " +
- "attempts to write to a field other than 'foo'.");
+ "For schema 'indexing_attribute_other', field 'foo': Indexing expression 'attribute bar' " +
+ "attempts to write to a field other than 'foo'.");
}
@Test
- public void testIndexChanged() throws IOException, ParseException {
+ void testIndexChanged() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_index_changed.sd",
- "For schema 'indexing_index_changed', field 'foo': For expression 'index foo': " +
- "Attempting to assign conflicting values to field 'foo'.");
+ "For schema 'indexing_index_changed', field 'foo': For expression 'index foo': " +
+ "Attempting to assign conflicting values to field 'foo'.");
}
@Test
- public void testIndexOther() throws IOException, ParseException {
+ void testIndexOther() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_index_other.sd",
- "For schema 'indexing_index_other', field 'foo': Indexing expression 'index bar' " +
- "attempts to write to a field other than 'foo'.");
+ "For schema 'indexing_index_other', field 'foo': Indexing expression 'index bar' " +
+ "attempts to write to a field other than 'foo'.");
}
@Test
- public void testSummaryChanged() throws IOException, ParseException {
+ void testSummaryChanged() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_summary_changed.sd",
- "For schema 'indexing_summary_fail', field 'foo': For expression 'summary foo': Attempting " +
- "to assign conflicting values to field 'foo'.");
+ "For schema 'indexing_summary_fail', field 'foo': For expression 'summary foo': Attempting " +
+ "to assign conflicting values to field 'foo'.");
}
@Test
- public void testSummaryOther() throws IOException, ParseException {
+ void testSummaryOther() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_summary_other.sd",
- "For schema 'indexing_summary_other', field 'foo': Indexing expression 'summary bar' " +
- "attempts to write to a field other than 'foo'.");
+ "For schema 'indexing_summary_other', field 'foo': Indexing expression 'summary bar' " +
+ "attempts to write to a field other than 'foo'.");
}
@Test
- public void testExtraField() throws IOException, ParseException {
+ void testExtraField() throws IOException, ParseException {
assertIndexing(
Arrays.asList("clear_state | guard { input my_index | tokenize normalize stem:\"BEST\" | index my_index | summary my_index }",
- "clear_state | guard { input my_input | tokenize normalize stem:\"BEST\" | index my_extra | summary my_extra }"),
+ "clear_state | guard { input my_input | tokenize normalize stem:\"BEST\" | index my_extra | summary my_extra }"),
ApplicationBuilder.buildFromFile("src/test/examples/indexing_extra.sd"));
}
@Test
- public void requireThatMultilineOutputConflictThrows() throws IOException, ParseException {
+ void requireThatMultilineOutputConflictThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_multiline_output_conflict.sd",
- "For schema 'indexing_multiline_output_confict', field 'cox': For expression 'index cox': " +
- "Attempting to assign conflicting values to field 'cox'.");
+ "For schema 'indexing_multiline_output_confict', field 'cox': For expression 'index cox': " +
+ "Attempting to assign conflicting values to field 'cox'.");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java
index 2784fe69b28..1f723924db6 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -15,16 +15,16 @@ import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuilds;
public class IndexingValuesTestCase {
@Test
- public void requireThatModifyFieldNoOutputDoesNotThrow() throws IOException, ParseException {
+ void requireThatModifyFieldNoOutputDoesNotThrow() throws IOException, ParseException {
assertBuilds("src/test/examples/indexing_modify_field_no_output.sd");
}
@Test
- public void requireThatInputOtherFieldThrows() throws IOException, ParseException {
+ void requireThatInputOtherFieldThrows() throws IOException, ParseException {
assertBuildFails("src/test/examples/indexing_input_other_field.sd",
- "For schema 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " +
- "attempts to modify the value of the document field 'bar'. " +
- "Use a field outside the document block instead.");
+ "For schema 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " +
+ "attempts to modify the value of the document field 'bar'. " +
+ "Use a field outside the document block instead.");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IntegerIndex2AttributeTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IntegerIndex2AttributeTestCase.java
index f36effab146..d3bfe7a8f55 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IntegerIndex2AttributeTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IntegerIndex2AttributeTestCase.java
@@ -9,13 +9,11 @@ import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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 baldersheim
@@ -23,7 +21,7 @@ import static org.junit.Assert.assertTrue;
public class IntegerIndex2AttributeTestCase extends AbstractSchemaTestCase {
@Test
- public void testIntegerIndex2Attribute() throws IOException, ParseException {
+ void testIntegerIndex2Attribute() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/integerindex2attribute.sd");
new IntegerIndex2Attribute(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles()).process(true, false);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/MatchPhaseSettingsValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/MatchPhaseSettingsValidatorTestCase.java
index 530b6a95ce8..cbddea8ea6a 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/MatchPhaseSettingsValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/MatchPhaseSettingsValidatorTestCase.java
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.processing;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuildFails;
@@ -12,25 +12,25 @@ public class MatchPhaseSettingsValidatorTestCase {
}
@Test
- public void requireThatAttributeMustExists() throws Exception {
+ void requireThatAttributeMustExists() throws Exception {
assertBuildFails("src/test/examples/matchphase/non_existing_attribute.sd",
getMessagePrefix() + "does not exists");
}
@Test
- public void requireThatAttributeMustBeNumeric() throws Exception {
+ void requireThatAttributeMustBeNumeric() throws Exception {
assertBuildFails("src/test/examples/matchphase/wrong_data_type_attribute.sd",
getMessagePrefix() + "must be single value numeric, but it is 'string'");
}
@Test
- public void requireThatAttributeMustBeSingleValue() throws Exception {
+ void requireThatAttributeMustBeSingleValue() throws Exception {
assertBuildFails("src/test/examples/matchphase/wrong_collection_type_attribute.sd",
getMessagePrefix() + "must be single value numeric, but it is 'Array<int>'");
}
@Test
- public void requireThatAttributeMustHaveFastSearch() throws Exception {
+ void requireThatAttributeMustHaveFastSearch() throws Exception {
assertBuildFails("src/test/examples/matchphase/non_fast_search_attribute.sd",
getMessagePrefix() + "must be fast-search, but it is not");
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java
index c401376ac3a..bd93a70d7cb 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java
@@ -7,24 +7,18 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author geirst
*/
public class MatchedElementsOnlyResolverTestCase {
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void complex_field_with_some_struct_field_attributes_gets_default_transform() throws ParseException {
+ void complex_field_with_some_struct_field_attributes_gets_default_transform() throws ParseException {
assertSummaryField(joinLines("field my_field type map<string, string> {",
" indexing: summary",
" summary: matched-elements-only",
@@ -48,7 +42,7 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void complex_field_with_only_struct_field_attributes_gets_attribute_transform() throws ParseException {
+ void complex_field_with_only_struct_field_attributes_gets_attribute_transform() throws ParseException {
assertSummaryField(joinLines("field my_field type map<string, string> {",
" indexing: summary",
" summary: matched-elements-only",
@@ -76,7 +70,7 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void explicit_complex_summary_field_can_use_filter_transform_with_reference_to_source_field() throws ParseException {
+ void explicit_complex_summary_field_can_use_filter_transform_with_reference_to_source_field() throws ParseException {
String documentSummary = joinLines("document-summary my_summary {",
" summary my_filter_field type map<string, string> {",
" source: my_field",
@@ -109,7 +103,7 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void primitive_array_attribute_field_gets_attribute_transform() throws ParseException {
+ void primitive_array_attribute_field_gets_attribute_transform() throws ParseException {
assertSummaryField(joinLines("field my_field type array<string> {",
" indexing: attribute | summary",
" summary: matched-elements-only",
@@ -118,7 +112,7 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void primitive_weighted_set_attribute_field_gets_attribute_transform() throws ParseException {
+ void primitive_weighted_set_attribute_field_gets_attribute_transform() throws ParseException {
assertSummaryField(joinLines("field my_field type weightedset<string> {",
" indexing: attribute | summary",
" summary: matched-elements-only",
@@ -127,7 +121,7 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void explicit_summary_field_can_use_filter_transform_with_reference_to_attribute_source_field() throws ParseException {
+ void explicit_summary_field_can_use_filter_transform_with_reference_to_attribute_source_field() throws ParseException {
String documentSummary = joinLines("document-summary my_summary {",
" summary my_filter_field type array<string> {",
" source: my_field",
@@ -147,17 +141,18 @@ public class MatchedElementsOnlyResolverTestCase {
}
@Test
- public void unsupported_field_type_throws() throws ParseException {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("For schema 'test', document summary 'default', summary field 'my_field': " +
+ void unsupported_field_type_throws() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ buildSearch(joinLines("field my_field type string {",
+ " indexing: summary",
+ " summary: matched-elements-only",
+ "}"));
+ });
+ assertTrue(exception.getMessage().contains("For schema 'test', document summary 'default', summary field 'my_field': " +
"'matched-elements-only' is not supported for this field type. " +
"Supported field types are: array of primitive, weighted set of primitive, " +
"array of simple struct, map of primitive type to simple struct, " +
- "and map of primitive type to primitive type");
- buildSearch(joinLines("field my_field type string {",
- " indexing: summary",
- " summary: matched-elements-only",
- "}"));
+ "and map of primitive type to primitive type"));
}
private void assertSummaryField(String fieldContent, String fieldName, SummaryTransform expTransform) throws ParseException {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/NGramTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/NGramTestCase.java
index 912e6fcf030..c143aa43d53 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/NGramTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/NGramTestCase.java
@@ -8,15 +8,12 @@ import com.yahoo.schema.document.MatchType;
import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.Stemming;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author bratseth
@@ -24,7 +21,7 @@ import static org.junit.Assert.fail;
public class NGramTestCase extends AbstractSchemaTestCase {
@Test
- public void testNGram() throws IOException, ParseException {
+ void testNGram() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/ngram.sd");
assertNotNull(schema);
@@ -36,8 +33,8 @@ public class NGramTestCase extends AbstractSchemaTestCase {
assertEquals(MatchType.GRAM, gram2.getMatching().getType());
assertEquals(-1, gram2.getMatching().getGramSize()); // Not set explicitly
- SDField gram3= schema.getConcreteField("gram_3");
- assertEquals(MatchType.GRAM,gram3.getMatching().getType());
+ SDField gram3 = schema.getConcreteField("gram_3");
+ assertEquals(MatchType.GRAM, gram3.getMatching().getType());
assertEquals(3, gram3.getMatching().getGramSize());
assertEquals("input gram_1 | ngram 1 | index gram_1 | summary gram_1", gram1.getIndexingScript().iterator().next().toString());
@@ -53,7 +50,7 @@ public class NGramTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testInvalidNGramSetting1() throws IOException, ParseException {
+ void testInvalidNGramSetting1() throws IOException, ParseException {
try {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/invalidngram1.sd");
fail("Should cause an exception");
@@ -64,7 +61,7 @@ public class NGramTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testInvalidNGramSetting2() throws IOException, ParseException {
+ void testInvalidNGramSetting2() throws IOException, ParseException {
try {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/invalidngram2.sd");
fail("Should cause an exception");
@@ -75,7 +72,7 @@ public class NGramTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testInvalidNGramSetting3() throws IOException, ParseException {
+ void testInvalidNGramSetting3() throws IOException, ParseException {
try {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/invalidngram3.sd");
fail("Should cause an exception");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java
index a291dda24b9..2a3a3ff93e9 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/PagedAttributeValidatorTestCase.java
@@ -3,27 +3,24 @@ package com.yahoo.schema.processing;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Optional;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static com.yahoo.schema.ApplicationBuilder.createFromString;
import static com.yahoo.schema.ApplicationBuilder.createFromStrings;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
public class PagedAttributeValidatorTestCase {
@Test
- public void dense_tensor_attribute_supports_paged_setting() throws ParseException {
+ void dense_tensor_attribute_supports_paged_setting() throws ParseException {
assertPagedSupported("tensor(x[2],y[2])");
}
@Test
- public void primitive_attribute_types_support_paged_setting() throws ParseException {
+ void primitive_attribute_types_support_paged_setting() throws ParseException {
assertPagedSupported("int");
assertPagedSupported("array<int>");
assertPagedSupported("weightedset<int>");
@@ -34,7 +31,7 @@ public class PagedAttributeValidatorTestCase {
}
@Test
- public void struct_field_attributes_support_paged_setting() throws ParseException {
+ void struct_field_attributes_support_paged_setting() throws ParseException {
var sd = joinLines("schema test {",
" document test {",
" struct elem {",
@@ -68,17 +65,17 @@ public class PagedAttributeValidatorTestCase {
}
@Test
- public void non_dense_tensor_attribute_does_not_support_paged_setting() throws ParseException {
+ void non_dense_tensor_attribute_does_not_support_paged_setting() throws ParseException {
assertPagedSettingNotSupported("tensor(x{},y[2])");
}
@Test
- public void predicate_attribute_does_not_support_paged_setting() throws ParseException {
+ void predicate_attribute_does_not_support_paged_setting() throws ParseException {
assertPagedSettingNotSupported("predicate");
}
@Test
- public void reference_attribute_does_not_support_paged_setting() throws ParseException {
+ void reference_attribute_does_not_support_paged_setting() throws ParseException {
assertPagedSettingNotSupported("reference<parent>", Optional.of(getSd("parent", "int")));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
index e4f32fff41d..1b950523588 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
@@ -11,12 +11,12 @@ import com.yahoo.schema.document.FieldSet;
import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Iterator;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Test Position processor.
@@ -26,7 +26,7 @@ import static org.junit.Assert.*;
public class PositionTestCase {
@Test
- public void inherited_position_zcurve_field_is_not_added_to_document_fieldset() throws Exception {
+ void inherited_position_zcurve_field_is_not_added_to_document_fieldset() throws Exception {
ApplicationBuilder sb = ApplicationBuilder.createFromFiles(Arrays.asList(
"src/test/examples/position_base.sd",
"src/test/examples/position_inherited.sd"));
@@ -37,7 +37,7 @@ public class PositionTestCase {
}
@Test
- public void requireThatPositionCanBeAttribute() throws Exception {
+ void requireThatPositionCanBeAttribute() throws Exception {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/position_attribute.sd");
assertNull(schema.getAttribute("pos"));
assertNull(schema.getAttribute("pos.x"));
@@ -48,18 +48,18 @@ public class PositionTestCase {
}
@Test
- public void requireThatPositionCanNotBeIndex() throws Exception {
+ void requireThatPositionCanNotBeIndex() throws Exception {
try {
ApplicationBuilder.buildFromFile("src/test/examples/position_index.sd");
fail();
} catch (IllegalArgumentException e) {
assertEquals("For schema 'position_index', field 'pos': Indexing of data type 'position' is not " +
- "supported, replace 'index' statement with 'attribute'.", e.getMessage());
+ "supported, replace 'index' statement with 'attribute'.", e.getMessage());
}
}
@Test
- public void requireThatSummaryAloneDoesNotCreateZCurve() throws Exception {
+ void requireThatSummaryAloneDoesNotCreateZCurve() throws Exception {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/position_summary.sd");
assertNull(schema.getAttribute("pos"));
assertNull(schema.getAttribute("pos.x"));
@@ -78,7 +78,7 @@ public class PositionTestCase {
}
@Test
- public void requireThatExtraFieldCanBePositionAttribute() throws Exception {
+ void requireThatExtraFieldCanBePositionAttribute() throws Exception {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/position_extra.sd");
assertNull(schema.getAttribute("pos_ext"));
assertNull(schema.getAttribute("pos_ext.x"));
@@ -89,7 +89,7 @@ public class PositionTestCase {
}
@Test
- public void requireThatPositionArrayIsSupported() throws Exception {
+ void requireThatPositionArrayIsSupported() throws Exception {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/position_array.sd");
assertNull(schema.getAttribute("pos"));
assertNull(schema.getAttribute("pos.x"));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankModifierTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankModifierTestCase.java
index 69bf62be84b..f49b1df8cea 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankModifierTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankModifierTestCase.java
@@ -5,7 +5,7 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -16,7 +16,7 @@ import java.io.IOException;
*/
public class RankModifierTestCase extends AbstractSchemaTestCase {
@Test
- public void testLiteral() throws IOException, ParseException {
+ void testLiteral() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/rankmodifier/literal.sd");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankProfileSearchFixture.java b/config-model/src/test/java/com/yahoo/schema/processing/RankProfileSearchFixture.java
index e380b1ab9af..15fe8250b71 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankProfileSearchFixture.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankProfileSearchFixture.java
@@ -27,7 +27,7 @@ import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Helper class for setting up and asserting over a Search instance with a rank profile given literally
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankPropertyVariablesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankPropertyVariablesTestCase.java
index dab1d9e6e95..077017cc70e 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankPropertyVariablesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankPropertyVariablesTestCase.java
@@ -9,22 +9,22 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.List;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
public class RankPropertyVariablesTestCase extends AbstractSchemaTestCase {
@Test
- public void testRankPropVariables() throws IOException, ParseException {
+ void testRankPropVariables() throws IOException, ParseException {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/rankpropvars.sd",
- new BaseDeployLogger(),
- rankProfileRegistry,
- new QueryProfileRegistry());
+ new BaseDeployLogger(),
+ rankProfileRegistry,
+ new QueryProfileRegistry());
assertRankPropEquals(rankProfileRegistry.get(schema, "other").getRankProperties(), "$testvar1", "foo");
assertRankPropEquals(rankProfileRegistry.get(schema, "other").getRankProperties(), "$testvar_2", "bar");
assertRankPropEquals(rankProfileRegistry.get(schema, "other").getRankProperties(), "$testvarOne23", "baz");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionTypeResolverTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionTypeResolverTestCase.java
index f2f2a82b97c..c6d6332b4c0 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionTypeResolverTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionTypeResolverTestCase.java
@@ -11,7 +11,7 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.searchlib.rankingexpression.rule.ReferenceNode;
import com.yahoo.tensor.TensorType;
import com.yahoo.yolean.Exceptions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
@@ -20,10 +20,7 @@ import java.util.logging.Level;
import java.util.stream.Collectors;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author bratseth
@@ -31,7 +28,7 @@ import static org.junit.Assert.fail;
public class RankingExpressionTypeResolverTestCase {
@Test
- public void tensorFirstPhaseMustProduceDouble() throws Exception {
+ void tensorFirstPhaseMustProduceDouble() throws Exception {
try {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
@@ -53,13 +50,13 @@ public class RankingExpressionTypeResolverTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("In schema 'test', rank profile 'my_rank_profile': The first-phase expression must produce a double (a tensor with no dimensions), but produces tensor(x[10],y[3])",
- Exceptions.toMessageString(expected));
+ Exceptions.toMessageString(expected));
}
}
@Test
- public void tensorFirstPhaseFromConstantMustProduceDouble() throws Exception {
+ void tensorFirstPhaseFromConstantMustProduceDouble() throws Exception {
try {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
@@ -95,14 +92,13 @@ public class RankingExpressionTypeResolverTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("In schema 'test', rank profile 'my_rank_profile': The first-phase expression must produce a double (a tensor with no dimensions), but produces tensor(x{},y{},z{})",
- Exceptions.toMessageString(expected));
+ Exceptions.toMessageString(expected));
}
}
-
@Test
- public void tensorSecondPhaseMustProduceDouble() throws Exception {
+ void tensorSecondPhaseMustProduceDouble() throws Exception {
try {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
@@ -127,12 +123,12 @@ public class RankingExpressionTypeResolverTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("In schema 'test', rank profile 'my_rank_profile': The second-phase expression must produce a double (a tensor with no dimensions), but produces tensor(x[10],y[3])",
- Exceptions.toMessageString(expected));
+ Exceptions.toMessageString(expected));
}
}
@Test
- public void tensorConditionsMustHaveTypeCompatibleBranches() throws Exception {
+ void tensorConditionsMustHaveTypeCompatibleBranches() throws Exception {
try {
ApplicationBuilder schemaBuilder = new ApplicationBuilder();
schemaBuilder.addSchema(joinLines(
@@ -157,14 +153,14 @@ public class RankingExpressionTypeResolverTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("In schema 'test', rank profile 'my_rank_profile': The first-phase expression is invalid: An if expression must produce compatible types in both alternatives, but the 'true' type is tensor(x[10],y[5]) while the 'false' type is tensor(z[10])" +
- "\n'true' branch: attribute(a)" +
- "\n'false' branch: attribute(b)",
- Exceptions.toMessageString(expected));
+ "\n'true' branch: attribute(a)" +
+ "\n'false' branch: attribute(b)",
+ Exceptions.toMessageString(expected));
}
}
@Test
- public void testFunctionInvocationTypes() throws Exception {
+ void testFunctionInvocationTypes() throws Exception {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry);
builder.addSchema(joinLines(
@@ -192,13 +188,13 @@ public class RankingExpressionTypeResolverTestCase {
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[3])"),
- summaryFeatures(profile).get("macro1(a)").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("macro1(a)").type(profile.typeContext(builder.getQueryProfileRegistry())));
assertEquals(TensorType.fromSpec("tensor(z[10])"),
- summaryFeatures(profile).get("macro1(b)").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("macro1(b)").type(profile.typeContext(builder.getQueryProfileRegistry())));
}
@Test
- public void testTensorFunctionInvocationTypes_Nested() throws Exception {
+ void testTensorFunctionInvocationTypes_Nested() throws Exception {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
"search test {",
@@ -234,52 +230,52 @@ public class RankingExpressionTypeResolverTestCase {
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"),
- summaryFeatures(profile).get("return_a").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("return_a").type(profile.typeContext(builder.getQueryProfileRegistry())));
assertEquals(TensorType.fromSpec("tensor(z[10])"),
- summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
}
@Test
- public void testAttributeInvocationViaBoundIdentifier() throws Exception {
+ void testAttributeInvocationViaBoundIdentifier() throws Exception {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
- "search newsarticle {",
- " document newsarticle {",
- " field title type string {",
- " indexing {",
- " input title | index",
- " }",
- " weight: 30",
- " }",
- " field usstaticrank type int {",
- " indexing: summary | attribute",
- " }",
- " field eustaticrank type int {",
- " indexing: summary | attribute",
- " }",
- " }",
- " rank-profile default {",
- " macro newsboost() { ",
- " expression: 200 * matches(title)",
- " }",
- " macro commonboost(mystaticrank) { ",
- " expression: attribute(mystaticrank) + newsboost",
- " }",
- " macro commonfirstphase(mystaticrank) { ",
- " expression: nativeFieldMatch(title) + commonboost(mystaticrank) ",
- " }",
- " first-phase { expression: commonfirstphase(usstaticrank) }",
- " }",
- " rank-profile eurank inherits default {",
- " first-phase { expression: commonfirstphase(eustaticrank) }",
- " }",
- "}"));
+ "search newsarticle {",
+ " document newsarticle {",
+ " field title type string {",
+ " indexing {",
+ " input title | index",
+ " }",
+ " weight: 30",
+ " }",
+ " field usstaticrank type int {",
+ " indexing: summary | attribute",
+ " }",
+ " field eustaticrank type int {",
+ " indexing: summary | attribute",
+ " }",
+ " }",
+ " rank-profile default {",
+ " macro newsboost() { ",
+ " expression: 200 * matches(title)",
+ " }",
+ " macro commonboost(mystaticrank) { ",
+ " expression: attribute(mystaticrank) + newsboost",
+ " }",
+ " macro commonfirstphase(mystaticrank) { ",
+ " expression: nativeFieldMatch(title) + commonboost(mystaticrank) ",
+ " }",
+ " first-phase { expression: commonfirstphase(usstaticrank) }",
+ " }",
+ " rank-profile eurank inherits default {",
+ " first-phase { expression: commonfirstphase(eustaticrank) }",
+ " }",
+ "}"));
builder.build(true);
RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "eurank");
}
@Test
- public void testTensorFunctionInvocationTypes_NestedSameName() throws Exception {
+ void testTensorFunctionInvocationTypes_NestedSameName() throws Exception {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
"search test {",
@@ -318,35 +314,35 @@ public class RankingExpressionTypeResolverTestCase {
RankProfile profile =
builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile");
assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"),
- summaryFeatures(profile).get("return_a").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("return_a").type(profile.typeContext(builder.getQueryProfileRegistry())));
assertEquals(TensorType.fromSpec("tensor(z[10])"),
- summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("return_b").type(profile.typeContext(builder.getQueryProfileRegistry())));
}
@Test
- public void testTensorFunctionInvocationTypes_viaFuncWithExpr() throws Exception {
+ void testTensorFunctionInvocationTypes_viaFuncWithExpr() throws Exception {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
- "search test {",
- " document test {",
- " field t1 type tensor<float>(y{}) { indexing: attribute | summary }",
- " field t2 type tensor<float>(x{}) { indexing: attribute | summary }",
- " }",
- " rank-profile test {",
- " function my_func(t) { expression: sum(t, x) + 1 }",
- " function test_func_via_func_with_expr() { expression: call_func_with_expr( attribute(t1), attribute(t2) ) }",
- " function call_func_with_expr(a, b) { expression: my_func( a * b ) }",
- " summary-features { test_func_via_func_with_expr }",
- " }",
- "}"));
+ "search test {",
+ " document test {",
+ " field t1 type tensor<float>(y{}) { indexing: attribute | summary }",
+ " field t2 type tensor<float>(x{}) { indexing: attribute | summary }",
+ " }",
+ " rank-profile test {",
+ " function my_func(t) { expression: sum(t, x) + 1 }",
+ " function test_func_via_func_with_expr() { expression: call_func_with_expr( attribute(t1), attribute(t2) ) }",
+ " function call_func_with_expr(a, b) { expression: my_func( a * b ) }",
+ " summary-features { test_func_via_func_with_expr }",
+ " }",
+ "}"));
builder.build(true);
RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "test");
assertEquals(TensorType.fromSpec("tensor<float>(y{})"),
- summaryFeatures(profile).get("test_func_via_func_with_expr").type(profile.typeContext(builder.getQueryProfileRegistry())));
+ summaryFeatures(profile).get("test_func_via_func_with_expr").type(profile.typeContext(builder.getQueryProfileRegistry())));
}
@Test
- public void importedFieldsAreAvailable() throws Exception {
+ void importedFieldsAreAvailable() throws Exception {
ApplicationBuilder builder = new ApplicationBuilder();
builder.addSchema(joinLines(
"search parent {",
@@ -361,7 +357,7 @@ public class RankingExpressionTypeResolverTestCase {
"search child {",
" document child { ",
" field ref type reference<parent> {",
- "indexing: attribute | summary",
+ "indexing: attribute | summary",
" }",
" }",
" import field ref.a as imported_a {}",
@@ -376,14 +372,14 @@ public class RankingExpressionTypeResolverTestCase {
}
@Test
- public void undeclaredQueryFeaturesAreAccepted() throws Exception {
+ void undeclaredQueryFeaturesAreAccepted() throws Exception {
InspectableDeployLogger logger = new InspectableDeployLogger();
ApplicationBuilder builder = new ApplicationBuilder(logger);
builder.addSchema(joinLines(
"search test {",
" document test { ",
" field anyfield type double {" +
- " indexing: attribute",
+ " indexing: attribute",
" }",
" }",
" rank-profile my_rank_profile {",
@@ -402,7 +398,7 @@ public class RankingExpressionTypeResolverTestCase {
}
@Test
- public void undeclaredQueryFeaturesAreNotAcceptedWhenStrict() throws Exception {
+ void undeclaredQueryFeaturesAreNotAcceptedWhenStrict() throws Exception {
try {
InspectableDeployLogger logger = new InspectableDeployLogger();
ApplicationBuilder builder = new ApplicationBuilder(logger);
@@ -410,12 +406,12 @@ public class RankingExpressionTypeResolverTestCase {
"search test {",
" document test { ",
" field anyfield type double {" +
- " indexing: attribute",
+ " indexing: attribute",
" }",
" }",
" rank-profile my_rank_profile {",
" strict: true" +
- " first-phase {",
+ " first-phase {",
" expression: query(foo) + f() + sum(attribute(anyfield))",
" }",
" function f() {",
@@ -428,12 +424,12 @@ public class RankingExpressionTypeResolverTestCase {
}
catch (IllegalArgumentException e) {
assertEquals("In schema 'test', rank profile 'my_rank_profile': rank profile 'my_rank_profile' is strict but is missing a query profile type declaration of features [query(bar), query(baz), query(foo)]",
- Exceptions.toMessageString(e));
+ Exceptions.toMessageString(e));
}
}
@Test
- public void undeclaredQueryFeaturesAreAcceptedWithWarningWhenUsingTensors() throws Exception {
+ void undeclaredQueryFeaturesAreAcceptedWithWarningWhenUsingTensors() throws Exception {
InspectableDeployLogger logger = new InspectableDeployLogger();
ApplicationBuilder builder = new ApplicationBuilder(logger);
builder.addSchema(joinLines(
@@ -457,24 +453,24 @@ public class RankingExpressionTypeResolverTestCase {
String message = logger.findMessage("The following query features");
assertNotNull(message);
assertEquals("WARNING: The following query features used in rank profile 'my_rank_profile' are not declared and " +
- "will be interpreted as scalars, not tensors: [query(bar), query(baz), query(foo)]",
- message);
+ "will be interpreted as scalars, not tensors: [query(bar), query(baz), query(foo)]",
+ message);
}
@Test
- public void noWarningWhenUsingTensorsWhenQueryFeaturesAreDeclared() throws Exception {
+ void noWarningWhenUsingTensorsWhenQueryFeaturesAreDeclared() throws Exception {
InspectableDeployLogger logger = new InspectableDeployLogger();
ApplicationBuilder builder = new ApplicationBuilder(logger);
QueryProfileType myType = new QueryProfileType("mytype");
myType.addField(new FieldDescription("rank.feature.query(foo)",
- new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
- builder.getQueryProfileRegistry().getTypeRegistry());
+ new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
+ builder.getQueryProfileRegistry().getTypeRegistry());
myType.addField(new FieldDescription("rank.feature.query(bar)",
- new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
- builder.getQueryProfileRegistry().getTypeRegistry());
+ new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
+ builder.getQueryProfileRegistry().getTypeRegistry());
myType.addField(new FieldDescription("rank.feature.query(baz)",
- new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
- builder.getQueryProfileRegistry().getTypeRegistry());
+ new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))),
+ builder.getQueryProfileRegistry().getTypeRegistry());
builder.getQueryProfileRegistry().getTypeRegistry().register(myType);
builder.addSchema(joinLines(
"search test {",
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithLightGBMTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithLightGBMTestCase.java
index 4df0a09ec2e..50cc12e9b33 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithLightGBMTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithLightGBMTestCase.java
@@ -5,8 +5,8 @@ import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.io.IOUtils;
import com.yahoo.path.Path;
import com.yahoo.schema.parser.ParseException;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -20,25 +20,25 @@ public class RankingExpressionWithLightGBMTestCase {
private final static String lightGBMExpression =
"if (!(numerical_2 >= 0.46643291586559305), 2.1594397038037663, if (categorical_2 in [\"k\", \"l\", \"m\"], 2.235297305276056, 2.1792953471546546)) + if (categorical_1 in [\"d\", \"e\"], 0.03070842919354316, if (!(numerical_1 >= 0.5102250691730842), -0.04439151147520909, 0.005117411709368601)) + if (!(numerical_2 >= 0.668665477622446), if (!(numerical_2 >= 0.008118820676863816), -0.15361238490967524, -0.01192330846157292), 0.03499044894987518) + if (!(numerical_1 >= 0.5201391072644542), -0.02141000620783247, if (categorical_1 in [\"a\", \"b\"], -0.004121485787596721, 0.04534090904886873)) + if (categorical_2 in [\"k\", \"l\", \"m\"], if (!(numerical_2 >= 0.27283279016959255), -0.01924803254356527, 0.03643772842347651), -0.02701711918923075)";
- @After
+ @AfterEach
public void removeGeneratedModelFiles() {
IOUtils.recursiveDeleteDir(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
}
@Test
- public void testLightGBMReference() {
+ void testLightGBMReference() {
RankProfileSearchFixture search = fixtureWith("lightgbm('regression.json')");
search.assertFirstPhaseExpression(lightGBMExpression, "my_profile");
}
@Test
- public void testNestedLightGBMReference() {
+ void testNestedLightGBMReference() {
RankProfileSearchFixture search = fixtureWith("5 + sum(lightgbm('regression.json'))");
search.assertFirstPhaseExpression("5 + reduce(" + lightGBMExpression + ", sum)", "my_profile");
}
@Test
- public void testImportingFromStoredExpressions() throws IOException {
+ void testImportingFromStoredExpressions() throws IOException {
RankProfileSearchFixture search = fixtureWith("lightgbm('regression.json')");
search.assertFirstPhaseExpression(lightGBMExpression, "my_profile");
@@ -47,7 +47,7 @@ public class RankingExpressionWithLightGBMTestCase {
try {
storedApplicationDirectory.toFile().mkdirs();
IOUtils.copyDirectory(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile(),
- storedApplicationDirectory.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
+ storedApplicationDirectory.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
RankingExpressionWithOnnxTestCase.StoringApplicationPackage storedApplication = new RankingExpressionWithOnnxTestCase.StoringApplicationPackage(storedApplicationDirectory);
RankProfileSearchFixture searchFromStored = fixtureWith("lightgbm('regression.json')");
searchFromStored.assertFirstPhaseExpression(lightGBMExpression, "my_profile");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java
index 1280895bfc0..22681858fc3 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java
@@ -12,23 +12,23 @@ import com.yahoo.vespa.config.search.core.RankingConstantsConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.search.DocumentDatabase;
import com.yahoo.vespa.model.search.IndexedSearchCluster;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
-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;
public class RankingExpressionWithOnnxModelTestCase {
private final Path applicationDir = Path.fromString("src/test/integration/onnx-model/");
- @After
+ @AfterEach
public void removeGeneratedModelFiles() {
IOUtils.recursiveDeleteDir(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
}
@Test
- public void testOnnxModelFeature() throws Exception {
+ void testOnnxModelFeature() throws Exception {
VespaModel model = loadModel(applicationDir);
assertTransformedFeature(model);
assertGeneratedConfig(model);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxTestCase.java
index bfd0520c62a..83d19b010bb 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxTestCase.java
@@ -12,8 +12,8 @@ import com.yahoo.schema.FeatureNames;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.tensor.TensorType;
import com.yahoo.yolean.Exceptions;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.FileReader;
@@ -23,10 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
public class RankingExpressionWithOnnxTestCase {
@@ -35,13 +32,13 @@ public class RankingExpressionWithOnnxTestCase {
private final static String name = "mnist_softmax";
private final static String vespaExpression = "join(reduce(join(rename(Placeholder, (d0, d1), (d0, d2)), constant(mnist_softmax_layer_Variable), f(a,b)(a * b)), sum, d2) * 1.0, constant(mnist_softmax_layer_Variable_1) * 1.0, f(a,b)(a + b))";
- @After
+ @AfterEach
public void removeGeneratedModelFiles() {
IOUtils.recursiveDeleteDir(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
}
@Test
- public void testOnnxReferenceWithConstantFeature() {
+ void testOnnxReferenceWithConstantFeature() {
RankProfileSearchFixture search = fixtureWith("constant(mytensor)",
"onnx_vespa('mnist_softmax.onnx')",
"constant mytensor { file: ignored\ntype: tensor<float>(d0[1],d1[784]) }",
@@ -50,12 +47,12 @@ public class RankingExpressionWithOnnxTestCase {
}
@Test
- public void testOnnxReferenceWithQueryFeature() {
+ void testOnnxReferenceWithQueryFeature() {
String queryProfile = "<query-profile id='default' type='root'/>";
String queryProfileType =
"<query-profile-type id='root'>" +
- " <field name='query(mytensor)' type='tensor&lt;float&gt;(d0[1],d1[784])'/>" +
- "</query-profile-type>";
+ " <field name='query(mytensor)' type='tensor&lt;float&gt;(d0[1],d1[784])'/>" +
+ "</query-profile-type>";
StoringApplicationPackage application = new StoringApplicationPackage(applicationDir,
queryProfile,
queryProfileType);
@@ -69,7 +66,7 @@ public class RankingExpressionWithOnnxTestCase {
}
@Test
- public void testOnnxReferenceWithDocumentFeature() {
+ void testOnnxReferenceWithDocumentFeature() {
StoringApplicationPackage application = new StoringApplicationPackage(applicationDir);
RankProfileSearchFixture search = fixtureWith("attribute(mytensor)",
"onnx_vespa('mnist_softmax.onnx')",
@@ -82,12 +79,12 @@ public class RankingExpressionWithOnnxTestCase {
@Test
- public void testOnnxReferenceWithFeatureCombination() {
+ void testOnnxReferenceWithFeatureCombination() {
String queryProfile = "<query-profile id='default' type='root'/>";
String queryProfileType =
"<query-profile-type id='root'>" +
- " <field name='query(mytensor)' type='tensor&lt;float&gt;(d0[1],d1[784],d2[10])'/>" +
- "</query-profile-type>";
+ " <field name='query(mytensor)' type='tensor&lt;float&gt;(d0[1],d1[784],d2[10])'/>" +
+ "</query-profile-type>";
StoringApplicationPackage application = new StoringApplicationPackage(applicationDir, queryProfile, queryProfileType);
RankProfileSearchFixture search = fixtureWith("sum(query(mytensor) * attribute(mytensor) * constant(mytensor),d2)",
"onnx_vespa('mnist_softmax.onnx')",
@@ -100,28 +97,28 @@ public class RankingExpressionWithOnnxTestCase {
@Test
- public void testNestedOnnxReference() {
+ void testNestedOnnxReference() {
RankProfileSearchFixture search = fixtureWith("tensor<float>(d0[1],d1[784])(0.0)",
"5 + sum(onnx_vespa('mnist_softmax.onnx'))");
search.assertFirstPhaseExpression("5 + reduce(" + vespaExpression + ", sum)", "my_profile");
}
@Test
- public void testOnnxReferenceWithSpecifiedOutput() {
+ void testOnnxReferenceWithSpecifiedOutput() {
RankProfileSearchFixture search = fixtureWith("tensor<float>(d0[1],d1[784])(0.0)",
"onnx_vespa('mnist_softmax.onnx', 'layer_add')");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
}
@Test
- public void testOnnxReferenceWithSpecifiedOutputAndSignature() {
+ void testOnnxReferenceWithSpecifiedOutputAndSignature() {
RankProfileSearchFixture search = fixtureWith("tensor<float>(d0[1],d1[784])(0.0)",
"onnx_vespa('mnist_softmax.onnx', 'default.layer_add')");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
}
@Test
- public void testOnnxReferenceMissingFunction() throws ParseException {
+ void testOnnxReferenceMissingFunction() throws ParseException {
try {
RankProfileSearchFixture search = new RankProfileSearchFixture(
new StoringApplicationPackage(applicationDir),
@@ -137,15 +134,15 @@ public class RankingExpressionWithOnnxTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("Rank profile 'my_profile' is invalid: Could not use Onnx model from " +
- "onnx_vespa(\"mnist_softmax.onnx\"): " +
- "Model refers input 'Placeholder' of type tensor<float>(d0[1],d1[784]) but this function is " +
- "not present in rank profile 'my_profile'",
+ "onnx_vespa(\"mnist_softmax.onnx\"): " +
+ "Model refers input 'Placeholder' of type tensor<float>(d0[1],d1[784]) but this function is " +
+ "not present in rank profile 'my_profile'",
Exceptions.toMessageString(expected));
}
}
@Test
- public void testOnnxReferenceWithWrongFunctionType() {
+ void testOnnxReferenceWithWrongFunctionType() {
try {
RankProfileSearchFixture search = fixtureWith("tensor(d0[1],d5[10])(0.0)",
"onnx_vespa('mnist_softmax.onnx')");
@@ -154,15 +151,15 @@ public class RankingExpressionWithOnnxTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("Rank profile 'my_profile' is invalid: Could not use Onnx model from " +
- "onnx_vespa(\"mnist_softmax.onnx\"): " +
- "Model refers input 'Placeholder'. The required type of this is tensor<float>(d0[1],d1[784]), " +
- "but this function returns tensor(d0[1],d5[10])",
+ "onnx_vespa(\"mnist_softmax.onnx\"): " +
+ "Model refers input 'Placeholder'. The required type of this is tensor<float>(d0[1],d1[784]), " +
+ "but this function returns tensor(d0[1],d5[10])",
Exceptions.toMessageString(expected));
}
}
@Test
- public void testOnnxReferenceSpecifyingNonExistingOutput() {
+ void testOnnxReferenceSpecifyingNonExistingOutput() {
try {
RankProfileSearchFixture search = fixtureWith("tensor<float>(d0[2],d1[784])(0.0)",
"onnx_vespa('mnist_softmax.onnx', 'y')");
@@ -171,14 +168,14 @@ public class RankingExpressionWithOnnxTestCase {
}
catch (IllegalArgumentException expected) {
assertEquals("Rank profile 'my_profile' is invalid: Could not use Onnx model from " +
- "onnx_vespa(\"mnist_softmax.onnx\",\"y\"): " +
- "No expressions named 'y' in model 'mnist_softmax.onnx'. Available expressions: default.layer_add",
- Exceptions.toMessageString(expected));
+ "onnx_vespa(\"mnist_softmax.onnx\",\"y\"): " +
+ "No expressions named 'y' in model 'mnist_softmax.onnx'. Available expressions: default.layer_add",
+ Exceptions.toMessageString(expected));
}
}
@Test
- public void testImportingFromStoredExpressions() throws IOException {
+ void testImportingFromStoredExpressions() throws IOException {
RankProfileSearchFixture search = fixtureWith("tensor<float>(d0[1],d1[784])(0.0)",
"onnx_vespa(\"mnist_softmax.onnx\")");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
@@ -206,7 +203,7 @@ public class RankingExpressionWithOnnxTestCase {
}
@Test
- public void testImportingFromStoredExpressionsWithFunctionOverridingConstantAndInheritance() throws IOException {
+ void testImportingFromStoredExpressionsWithFunctionOverridingConstantAndInheritance() throws IOException {
String rankProfile =
" rank-profile my_profile {\n" +
" function Placeholder() {\n" +
@@ -230,8 +227,8 @@ public class RankingExpressionWithOnnxTestCase {
search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile");
search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile_child");
- assertNull("Constant overridden by function is not added",
- search.search().constants().get(name + "_Variable"));
+ assertNull(search.search().constants().get(name + "_Variable"),
+ "Constant overridden by function is not added");
// At this point the expression is stored - copy application to another location which do not have a models dir
Path storedApplicationDirectory = applicationDir.getParentPath().append("copy");
@@ -245,18 +242,18 @@ public class RankingExpressionWithOnnxTestCase {
searchFromStored.compileRankProfile("my_profile_child", applicationDir.append("models"));
searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile");
searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile_child");
- assertNull("Constant overridden by function is not added",
- searchFromStored.search().constants().get(name + "_Variable"));
+ assertNull(searchFromStored.search().constants().get(name + "_Variable"),
+ "Constant overridden by function is not added");
} finally {
IOUtils.recursiveDeleteDir(storedApplicationDirectory.toFile());
}
}
@Test
- public void testFunctionGeneration() {
+ void testFunctionGeneration() {
final String name = "small_constants_and_functions";
final String rankProfiles =
- " rank-profile my_profile {\n" +
+ " rank-profile my_profile {\n" +
" function input() {\n" +
" expression: tensor<float>(d0[3])(0.0)\n" +
" }\n" +
@@ -275,7 +272,7 @@ public class RankingExpressionWithOnnxTestCase {
}
@Test
- public void testImportingFromStoredExpressionsWithSmallConstantsAndInheritance() throws IOException {
+ void testImportingFromStoredExpressionsWithSmallConstantsAndInheritance() throws IOException {
final String name = "small_constants_and_functions";
final String rankProfiles =
" rank-profile my_profile {\n" +
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTensorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTensorTestCase.java
index 1f065bc7a20..c5bd0821007 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTensorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTensorTestCase.java
@@ -2,10 +2,10 @@
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-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 geirst
@@ -13,16 +13,16 @@ import static org.junit.Assert.fail;
public class RankingExpressionWithTensorTestCase {
@Test
- public void requireThatSingleLineConstantMappedTensorCanBeParsed() throws ParseException {
+ void requireThatSingleLineConstantMappedTensorCanBeParsed() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x{},y{}):{ {x:1,y:2}:1, {x:2,y:1}:2 }\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x{},y{}):{ {x:1,y:2}:1, {x:2,y:1}:2 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x{},y{}):{{x:1,y:2}:1.0, {x:2,y:1}:2.0}", "constant(my_tensor).value", "my_profile");
@@ -30,16 +30,16 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatSingleLineConstantIndexedTensorCanBeParsed() throws ParseException {
+ void requireThatSingleLineConstantIndexedTensorCanBeParsed() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x[3]):{ {x:0}:1, {x:1}:2, {x:2}:3 }\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x[3]):{ {x:0}:1, {x:1}:2, {x:2}:3 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x[3]):[1.0, 2.0, 3.0]", "constant(my_tensor).value", "my_profile");
@@ -47,16 +47,16 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatSingleLineConstantIndexedTensorShortFormCanBeParsed() throws ParseException {
+ void requireThatSingleLineConstantIndexedTensorShortFormCanBeParsed() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x[3]):[1, 2, 3]\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x[3]):[1, 2, 3]\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x[3]):[1.0, 2.0, 3.0]", "constant(my_tensor).value", "my_profile");
@@ -64,16 +64,16 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireConstantTensorCanBeReferredViaConstantFeature() throws ParseException {
+ void requireConstantTensorCanBeReferredViaConstantFeature() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum(constant(my_tensor))\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x{},y{}):{{x:1,y:2}:1, {x:2,y:1}:2}\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: sum(constant(my_tensor))\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x{},y{}):{{x:1,y:2}:1, {x:2,y:1}:2}\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x{},y{}):{{x:1,y:2}:1.0, {x:2,y:1}:2.0}", "constant(my_tensor).value", "my_profile");
@@ -81,18 +81,18 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatMultiLineConstantTensorAndTypeCanBeParsed() throws ParseException {
+ void requireThatMultiLineConstantTensorAndTypeCanBeParsed() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x{},y{}):\n" +
- " { {x:1,y:2}:1,\n" +
- " {x:2,y:1}:2 }\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x{},y{}):\n" +
+ " { {x:1,y:2}:1,\n" +
+ " {x:2,y:1}:2 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x{},y{}):{{x:1,y:2}:1.0, {x:2,y:1}:2.0}", "constant(my_tensor).value", "my_profile");
@@ -100,16 +100,16 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatConstantTensorsCanBeUsedInSecondPhaseExpression() throws ParseException {
+ void requireThatConstantTensorsCanBeUsedInSecondPhaseExpression() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " second-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
- " }\n" +
- " }");
+ " second-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertSecondPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x{}):{1:1.0}", "constant(my_tensor).value", "my_profile");
@@ -117,20 +117,20 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatConstantTensorsCanBeUsedInInheritedRankProfile() throws ParseException {
+ void requireThatConstantTensorsCanBeUsedInInheritedRankProfile() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile parent {\n" +
- " constants {\n" +
- " my_tensor {\n" +
- " value: { {x:1}:1 }\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- " rank-profile my_profile inherits parent {\n" +
- " first-phase {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " }");
+ " constants {\n" +
+ " my_tensor {\n" +
+ " value: { {x:1}:1 }\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ " rank-profile my_profile inherits parent {\n" +
+ " first-phase {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("tensor(x{}):{1:1.0}", "constant(my_tensor).value", "my_profile");
@@ -138,19 +138,19 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatConstantTensorsCanBeUsedInFunction() throws ParseException {
+ void requireThatConstantTensorsCanBeUsedInFunction() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " function my_macro() {\n" +
- " expression: sum(my_tensor)\n" +
- " }\n" +
- " first-phase {\n" +
- " expression: 5.0 + my_macro\n" +
- " }\n" +
- " constants {\n" +
- " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
- " }\n" +
- " }");
+ " function my_macro() {\n" +
+ " expression: sum(my_tensor)\n" +
+ " }\n" +
+ " first-phase {\n" +
+ " expression: 5.0 + my_macro\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("5.0 + my_macro", "my_profile");
f.assertFunction("reduce(constant(my_tensor), sum)", "my_macro", "my_profile");
@@ -159,18 +159,18 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatCombinationOfConstantTensorsAndConstantValuesCanBeUsed() throws ParseException {
+ void requireThatCombinationOfConstantTensorsAndConstantValuesCanBeUsed() throws ParseException {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: my_number_1 + sum(my_tensor) + my_number_2\n" +
- " }\n" +
- " constants {\n" +
- " my_number_1 double: 3.0\n" +
- " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
- " my_number_2 double: 5.0\n" +
- " }\n" +
- " }");
+ " first-phase {\n" +
+ " expression: my_number_1 + sum(my_tensor) + my_number_2\n" +
+ " }\n" +
+ " constants {\n" +
+ " my_number_1 double: 3.0\n" +
+ " my_tensor tensor(x{}):{ {x:1}:1 }\n" +
+ " my_number_2 double: 5.0\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
f.assertFirstPhaseExpression("3.0 + reduce(constant(my_tensor), sum) + 5.0", "my_profile");
f.assertRankProperty("tensor(x{}):{1:1.0}", "constant(my_tensor).value", "my_profile");
@@ -178,20 +178,20 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatInvalidTensorTypeSpecThrowsException() throws ParseException {
+ void requireThatInvalidTensorTypeSpecThrowsException() throws ParseException {
try {
RankProfileSearchFixture f = new RankProfileSearchFixture(
" rank-profile my_profile {\n" +
- " constants {\n" +
- " my_tensor tensor(x):{ {x:1}:1 }\n" +
- " }\n" +
- " }");
+ " constants {\n" +
+ " my_tensor tensor(x):{ {x:1}:1 }\n" +
+ " }\n" +
+ " }");
f.compileRankProfile("my_profile");
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertStartsWith("Type of constant(my_tensor): Illegal tensor type spec: A tensor type spec must be on the form",
- e.getMessage());
+ e.getMessage());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
index f8086fb3bc6..5c82be0745e 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
@@ -17,16 +17,16 @@ import com.yahoo.searchlib.rankingexpression.RankingExpression;
import com.yahoo.searchlib.rankingexpression.evaluation.MapContext;
import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue;
import com.yahoo.tensor.Tensor;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class RankingExpressionWithTransformerTokensTestCase {
@Test
- public void testTokenInputIds() throws Exception {
+ void testTokenInputIds() throws Exception {
String expected = "tensor(d0[1],d1[12]):[101,1,2,102,3,4,5,102,6,7,102,0]";
String a = "tensor(d0[2]):[1,2]";
String b = "tensor(d0[3]):[3,4,5]";
@@ -37,7 +37,7 @@ public class RankingExpressionWithTransformerTokensTestCase {
}
@Test
- public void testTokenTypeIds() throws Exception {
+ void testTokenTypeIds() throws Exception {
String expected = "tensor(d0[1],d1[10]):[0,0,0,0,1,1,1,1,0,0]";
String a = "tensor(d0[2]):[1,2]";
String b = "tensor(d0[3]):[3,4,5]";
@@ -47,7 +47,7 @@ public class RankingExpressionWithTransformerTokensTestCase {
}
@Test
- public void testAttentionMask() throws Exception {
+ void testAttentionMask() throws Exception {
String expected = "tensor(d0[1],d1[10]):[1,1,1,1,1,1,1,1,0,0]";
String a = "tensor(d0[2]):[1,2]";
String b = "tensor(d0[3]):[3,4,5]";
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithXGBoostTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithXGBoostTestCase.java
index e1b1473a59a..d01bb1be377 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithXGBoostTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithXGBoostTestCase.java
@@ -5,8 +5,8 @@ import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.io.IOUtils;
import com.yahoo.path.Path;
import com.yahoo.schema.parser.ParseException;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -22,25 +22,25 @@ public class RankingExpressionWithXGBoostTestCase {
"if (f29 < -0.1234567, if (!(f56 >= -0.242398), 1.71218, -1.70044), if (f109 < 0.8723473, -1.94071, 1.85965)) + " +
"if (!(f60 >= -0.482947), if (f29 < -4.2387498, 0.784718, -0.96853), -6.23624)";
- @After
+ @AfterEach
public void removeGeneratedModelFiles() {
IOUtils.recursiveDeleteDir(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
}
@Test
- public void testXGBoostReference() {
+ void testXGBoostReference() {
RankProfileSearchFixture search = fixtureWith("xgboost('xgboost.2.2.json')");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
}
@Test
- public void testNestedXGBoostReference() {
+ void testNestedXGBoostReference() {
RankProfileSearchFixture search = fixtureWith("5 + sum(xgboost('xgboost.2.2.json'))");
search.assertFirstPhaseExpression("5 + reduce(" + vespaExpression + ", sum)", "my_profile");
}
@Test
- public void testImportingFromStoredExpressions() throws IOException {
+ void testImportingFromStoredExpressions() throws IOException {
RankProfileSearchFixture search = fixtureWith("xgboost('xgboost.2.2.json')");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
@@ -49,7 +49,7 @@ public class RankingExpressionWithXGBoostTestCase {
try {
storedApplicationDirectory.toFile().mkdirs();
IOUtils.copyDirectory(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile(),
- storedApplicationDirectory.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
+ storedApplicationDirectory.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
RankingExpressionWithOnnxTestCase.StoringApplicationPackage storedApplication = new RankingExpressionWithOnnxTestCase.StoringApplicationPackage(storedApplicationDirectory);
RankProfileSearchFixture searchFromStored = fixtureWith("xgboost('xgboost.2.2.json')");
searchFromStored.assertFirstPhaseExpression(vespaExpression, "my_profile");
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
index c985d427a5a..526576c9e0b 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
@@ -18,15 +18,14 @@ import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.derived.TestableDeployLogger;
import com.yahoo.schema.parser.ParseException;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
@@ -35,7 +34,7 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testFunctions() throws IOException, ParseException {
+ void testFunctions() throws IOException, ParseException {
ModelContext.Properties deployProperties = new TestProperties();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
Schema schema = createSearch("src/test/examples/rankingexpressionfunction", deployProperties, rankProfileRegistry);
@@ -46,13 +45,13 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
assertEquals("var2", functions.get("titlematch").function().arguments().get(1));
assertEquals("var1 * var2 + 890", functions.get("titlematch").function().getBody().getRoot().toString());
assertEquals("0.8 + 0.2 * titlematch(4,5) + 0.8 * titlematch(7,8) * closeness(distance)",
- functionsRankProfile.getFirstPhaseRanking().getRoot().toString());
+ functionsRankProfile.getFirstPhaseRanking().getRoot().toString());
assertEquals("78 + closeness(distance)",
- functions.get("artistmatch").function().getBody().getRoot().toString());
+ functions.get("artistmatch").function().getBody().getRoot().toString());
assertEquals(0, functions.get("artistmatch").function().arguments().size());
RawRankProfile rawRankProfile = new RawRankProfile(functionsRankProfile, new LargeRankExpressions(new MockFileRegistry()), new QueryProfileRegistry(),
- new ImportedMlModels(), new AttributeFields(schema), deployProperties);
+ new ImportedMlModels(), new AttributeFields(schema), deployProperties);
List<Pair<String, String>> rankProperties = rawRankProfile.configProperties();
assertEquals(6, rankProperties.size());
@@ -72,11 +71,13 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
assertEquals("4 * 5 + 890", rankProperties.get(0).getSecond());
}
- @Test(expected = IllegalArgumentException.class)
- public void testThatIncludingFileInSubdirFails() throws IOException, ParseException {
- RankProfileRegistry registry = new RankProfileRegistry();
- Schema schema = createSearch("src/test/examples/rankingexpressioninfile", new TestProperties(), registry);
- new DerivedConfiguration(schema, registry); // rank profile parsing happens during deriving
+ @Test
+ void testThatIncludingFileInSubdirFails() throws IOException, ParseException {
+ assertThrows(IllegalArgumentException.class, () -> {
+ RankProfileRegistry registry = new RankProfileRegistry();
+ Schema schema = createSearch("src/test/examples/rankingexpressioninfile", new TestProperties(), registry);
+ new DerivedConfiguration(schema, registry); // rank profile parsing happens during deriving
+ }); // rank profile parsing happens during deriving
}
private void verifyProfile(RankProfile profile, List<String> expectedFunctions, List<Pair<String, String>> rankProperties,
@@ -114,7 +115,7 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
}
@Test
- public void testLargeInheritedFunctions() throws IOException, ParseException {
+ void testLargeInheritedFunctions() throws IOException, ParseException {
ModelContext.Properties properties = new TestProperties();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
LargeRankExpressions largeExpressions = new LargeRankExpressions(new MockFileRegistry(), 50);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ReferenceFieldTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ReferenceFieldTestCase.java
index 57b4d928a52..5f26e7b2964 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ReferenceFieldTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ReferenceFieldTestCase.java
@@ -9,43 +9,35 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author bjorncs
*/
public class ReferenceFieldTestCase {
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void reference_fields_are_parsed_from_search_definition() throws ParseException {
+ void reference_fields_are_parsed_from_search_definition() throws ParseException {
ApplicationBuilder builder = new ApplicationBuilder();
String campaignSdContent =
"schema campaign {\n" +
- " document campaign {\n" +
- " }\n" +
- "}";
+ " document campaign {\n" +
+ " }\n" +
+ "}";
String salespersonSdContent =
"schema salesperson {\n" +
- " document salesperson {\n" +
- " }\n" +
- "}";
+ " document salesperson {\n" +
+ " }\n" +
+ "}";
String adSdContent =
"schema ad {\n" +
- " document ad {\n" +
- " field campaign_ref type reference<campaign> { indexing: attribute }\n" +
- " field salesperson_ref type reference<salesperson> { indexing: attribute }\n" +
- " }\n" +
- "}";
+ " document ad {\n" +
+ " field campaign_ref type reference<campaign> { indexing: attribute }\n" +
+ " field salesperson_ref type reference<salesperson> { indexing: attribute }\n" +
+ " }\n" +
+ "}";
builder.addSchema(campaignSdContent);
builder.addSchema(salespersonSdContent);
builder.addSchema(adSdContent);
@@ -56,37 +48,38 @@ public class ReferenceFieldTestCase {
}
@Test
- public void cyclic_document_dependencies_are_detected() throws ParseException {
- var builder = new ApplicationBuilder(new TestProperties());
- String campaignSdContent =
- "schema campaign {\n" +
- " document campaign {\n" +
- " field ad_ref type reference<ad> { indexing: attribute }\n" +
- " }\n" +
- "}";
- String adSdContent =
- "schema ad {\n" +
- " document ad {\n" +
- " field campaign_ref type reference<campaign> { indexing: attribute }\n" +
- " }\n" +
- "}";
- builder.addSchema(campaignSdContent);
- builder.addSchema(adSdContent);
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("reference cycle for documents");
- builder.build(true);
+ void cyclic_document_dependencies_are_detected() throws ParseException {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ var builder = new ApplicationBuilder(new TestProperties());
+ String campaignSdContent =
+ "schema campaign {\n" +
+ " document campaign {\n" +
+ " field ad_ref type reference<ad> { indexing: attribute }\n" +
+ " }\n" +
+ "}";
+ String adSdContent =
+ "schema ad {\n" +
+ " document ad {\n" +
+ " field campaign_ref type reference<campaign> { indexing: attribute }\n" +
+ " }\n" +
+ "}";
+ builder.addSchema(campaignSdContent);
+ builder.addSchema(adSdContent);
+ builder.build(true);
+ });
+ assertTrue(exception.getMessage().contains("reference cycle for documents"));
}
private static void assertSearchContainsReferenceField(String expectedFieldname,
String referencedDocType,
SDDocumentType documentType) {
Field field = documentType.getDocumentType().getField(expectedFieldname);
- assertNotNull("Field does not exist in document type: " + expectedFieldname, field);
+ assertNotNull(field, "Field does not exist in document type: " + expectedFieldname);
DataType dataType = field.getDataType();
assertTrue(dataType instanceof NewDocumentReferenceDataType);
NewDocumentReferenceDataType refField = (NewDocumentReferenceDataType) dataType;
assertEquals(referencedDocType, refField.getTargetTypeName());
- assertTrue(! refField.isTemporary());
+ assertFalse(refField.isTemporary());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ReservedDocumentNamesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ReservedDocumentNamesTestCase.java
index 974d8c261ca..404b8f648cf 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ReservedDocumentNamesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ReservedDocumentNamesTestCase.java
@@ -3,12 +3,12 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.derived.AbstractExportingTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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
@@ -16,7 +16,7 @@ import static org.junit.Assert.fail;
public class ReservedDocumentNamesTestCase extends AbstractExportingTestCase {
@Test
- public void requireThatPositionIsAReservedDocumentName() throws IOException, ParseException {
+ void requireThatPositionIsAReservedDocumentName() throws IOException, ParseException {
try {
assertCorrectDeriving("reserved_position");
fail();
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ReservedRankingExpressionFunctionNamesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ReservedRankingExpressionFunctionNamesTestCase.java
index e405a105f3c..f657efffde7 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ReservedRankingExpressionFunctionNamesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ReservedRankingExpressionFunctionNamesTestCase.java
@@ -5,12 +5,12 @@ import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.schema.RankProfileRegistry;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.logging.Level;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author lesters
@@ -18,7 +18,7 @@ import static org.junit.Assert.assertTrue;
public class ReservedRankingExpressionFunctionNamesTestCase {
@Test
- public void requireThatFunctionsWithReservedNamesIssueAWarning() throws ParseException {
+ void requireThatFunctionsWithReservedNamesIssueAWarning() throws ParseException {
TestDeployLogger deployLogger = new TestDeployLogger();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
ApplicationBuilder builder = new ApplicationBuilder(deployLogger, rankProfileRegistry);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java b/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
index 03f9d7c5960..6e5e17398d9 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
@@ -3,11 +3,11 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* @author hmusum
@@ -15,13 +15,13 @@ import static org.junit.Assert.fail;
public class SchemaMustHaveDocumentTest {
@Test
- public void requireErrorWhenMissingDocument() throws IOException, ParseException {
+ void requireErrorWhenMissingDocument() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_missing_document.sd");
fail("SD without document");
} catch (IllegalArgumentException e) {
if (!e.getMessage()
- .contains("For schema 'imageconfig': A search specification must have an equally named document inside of it.")) {
+ .contains("For schema 'imageconfig': A search specification must have an equally named document inside of it.")) {
throw e;
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java
index 76132a4d09f..c5f0fb49946 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java
@@ -5,15 +5,15 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.documentmodel.SummaryTransform;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SummaryConsistencyTestCase {
@Test
- public void attribute_combiner_transform_is_set_when_source_is_array_of_struct_with_only_struct_field_attributes() throws ParseException {
+ void attribute_combiner_transform_is_set_when_source_is_array_of_struct_with_only_struct_field_attributes() throws ParseException {
String sd = joinLines(
"search structmemorysummary {",
" document structmemorysummary {",
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryFieldsMustHaveValidSourceTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryFieldsMustHaveValidSourceTestCase.java
index d94815015d7..22151063eb7 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryFieldsMustHaveValidSourceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryFieldsMustHaveValidSourceTestCase.java
@@ -9,17 +9,17 @@ import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
import com.yahoo.vespa.model.container.search.QueryProfiles;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-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;
public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTestCase {
@Test
- public void requireThatInvalidSourceIsCaught() throws IOException, ParseException {
+ void requireThatInvalidSourceIsCaught() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalidsummarysource.sd");
fail("This should throw and never get here");
@@ -29,7 +29,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest
}
@Test
- public void requireThatInvalidImplicitSourceIsCaught() throws IOException, ParseException {
+ void requireThatInvalidImplicitSourceIsCaught() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalidimplicitsummarysource.sd");
fail("This should throw and never get here");
@@ -39,7 +39,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest
}
@Test
- public void requireThatInvalidSelfReferingSingleSource() throws IOException, ParseException {
+ void requireThatInvalidSelfReferingSingleSource() throws IOException, ParseException {
try {
ApplicationBuilder.buildFromFile("src/test/examples/invalidselfreferringsummary.sd");
fail("This should throw and never get here");
@@ -49,7 +49,7 @@ public class SummaryFieldsMustHaveValidSourceTestCase extends AbstractSchemaTest
}
@Test
- public void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException {
+ void requireThatDocumentIdIsAllowedToPass() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/documentidinsummary.sd");
BaseDeployLogger deployLogger = new BaseDeployLogger();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java
index 9164f361a92..60e1e35fb2e 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/TensorFieldTestCase.java
@@ -3,15 +3,12 @@ package com.yahoo.schema.processing;
import com.yahoo.schema.document.Attribute;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static com.yahoo.schema.ApplicationBuilder.createFromString;
import static com.yahoo.config.model.test.TestUtil.joinLines;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author geirst
@@ -19,32 +16,32 @@ import static org.junit.Assert.fail;
public class TensorFieldTestCase {
@Test
- public void requireThatTensorFieldCannotBeOfCollectionType() throws ParseException {
+ void requireThatTensorFieldCannotBeOfCollectionType() throws ParseException {
try {
createFromString(getSd("field f1 type array<tensor(x{})> {}"));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'f1': A field with collection type of tensor is not supported. Use simple type 'tensor' instead.",
- e.getMessage());
+ e.getMessage());
}
}
@Test
- public void requireThatTensorFieldCannotBeIndexField() throws ParseException {
+ void requireThatTensorFieldCannotBeIndexField() throws ParseException {
try {
createFromString(getSd("field f1 type tensor(x{}) { indexing: index }"));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'f1': A tensor of type 'tensor(x{})' does not support having an 'index'. " +
- "Currently, only tensors with 1 indexed dimension supports that.",
- e.getMessage());
+ "Currently, only tensors with 1 indexed dimension supports that.",
+ e.getMessage());
}
}
@Test
- public void requireThatIndexedTensorAttributeCannotBeFastSearch() throws ParseException {
+ void requireThatIndexedTensorAttributeCannotBeFastSearch() throws ParseException {
try {
createFromString(getSd("field f1 type tensor(x[3]) { indexing: attribute \n attribute: fast-search }"));
fail("Expected exception");
@@ -55,7 +52,7 @@ public class TensorFieldTestCase {
}
@Test
- public void requireThatIndexedTensorAttributeCannotBeFastRank() throws ParseException {
+ void requireThatIndexedTensorAttributeCannotBeFastRank() throws ParseException {
try {
createFromString(getSd("field f1 type tensor(x[3]) { indexing: attribute \n attribute: fast-rank }"));
fail("Expected exception");
@@ -66,7 +63,7 @@ public class TensorFieldTestCase {
}
@Test
- public void requireThatIllegalTensorTypeSpecThrowsException() throws ParseException {
+ void requireThatIllegalTensorTypeSpecThrowsException() throws ParseException {
try {
createFromString(getSd("field f1 type tensor(invalid) { indexing: attribute }"));
fail("Expected exception");
@@ -77,19 +74,19 @@ public class TensorFieldTestCase {
}
@Test
- public void hnsw_index_is_default_turned_off() throws ParseException {
+ void hnsw_index_is_default_turned_off() throws ParseException {
var attr = getAttributeFromSd("field t1 type tensor(x[64]) { indexing: attribute }", "t1");
assertFalse(attr.hnswIndexParams().isPresent());
}
@Test
- public void hnsw_index_gets_default_parameters_if_not_specified() throws ParseException {
+ void hnsw_index_gets_default_parameters_if_not_specified() throws ParseException {
assertHnswIndexParams("", 16, 200);
assertHnswIndexParams("index: hnsw", 16, 200);
}
@Test
- public void hnsw_index_parameters_can_be_specified() throws ParseException {
+ void hnsw_index_parameters_can_be_specified() throws ParseException {
assertHnswIndexParams("index { hnsw { max-links-per-node: 32 } }", 32, 200);
assertHnswIndexParams("index { hnsw { neighbors-to-explore-at-insert: 300 } }", 16, 300);
assertHnswIndexParams(joinLines("index {",
@@ -102,7 +99,7 @@ public class TensorFieldTestCase {
}
@Test
- public void tensor_with_hnsw_index_must_be_an_attribute() throws ParseException {
+ void tensor_with_hnsw_index_must_be_an_attribute() throws ParseException {
try {
createFromString(getSd("field t1 type tensor(x[64]) { indexing: index }"));
fail("Expected exception");
@@ -113,7 +110,7 @@ public class TensorFieldTestCase {
}
@Test
- public void tensor_with_hnsw_index_parameters_must_be_an_index() throws ParseException {
+ void tensor_with_hnsw_index_parameters_must_be_an_index() throws ParseException {
try {
createFromString(getSd(joinLines(
"field t1 type tensor(x[64]) {",
@@ -132,7 +129,7 @@ public class TensorFieldTestCase {
}
@Test
- public void tensors_with_at_least_one_mapped_dimension_can_be_direct() throws ParseException {
+ void tensors_with_at_least_one_mapped_dimension_can_be_direct() throws ParseException {
assertTrue(getAttributeFromSd(
"field t1 type tensor(x{}) { indexing: attribute \n attribute: fast-search }", "t1").isFastSearch());
assertTrue(getAttributeFromSd(
@@ -140,7 +137,7 @@ public class TensorFieldTestCase {
}
@Test
- public void tensors_with_at_least_one_mapped_dimension_can_be_fast_rank() throws ParseException {
+ void tensors_with_at_least_one_mapped_dimension_can_be_fast_rank() throws ParseException {
assertTrue(getAttributeFromSd(
"field t1 type tensor(x{}) { indexing: attribute \n attribute: fast-rank }", "t1").isFastRank());
assertTrue(getAttributeFromSd(
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/TensorTransformTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/TensorTransformTestCase.java
index aaf5f381c62..028ad5dea86 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/TensorTransformTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/TensorTransformTestCase.java
@@ -20,109 +20,109 @@ import com.yahoo.schema.derived.AttributeFields;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.schema.parser.ParseException;
import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
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;
public class TensorTransformTestCase extends AbstractSchemaTestCase {
@Test
- public void requireThatNormalMaxAndMinAreNotReplaced() throws ParseException {
+ void requireThatNormalMaxAndMinAreNotReplaced() throws ParseException {
assertTransformedExpression("max(1.0,2.0)",
- "max(1.0,2.0)");
+ "max(1.0,2.0)");
assertTransformedExpression("min(attribute(double_field),x)",
- "min(attribute(double_field),x)");
+ "min(attribute(double_field),x)");
assertTransformedExpression("max(attribute(double_field),attribute(double_array_field))",
- "max(attribute(double_field),attribute(double_array_field))");
+ "max(attribute(double_field),attribute(double_array_field))");
assertTransformedExpression("min(attribute(tensor_field_1),attribute(double_field))",
- "min(attribute(tensor_field_1),attribute(double_field))");
+ "min(attribute(tensor_field_1),attribute(double_field))");
assertTransformedExpression("reduce(max(attribute(tensor_field_1),attribute(tensor_field_2)),sum)",
- "reduce(max(attribute(tensor_field_1),attribute(tensor_field_2)),sum)");
+ "reduce(max(attribute(tensor_field_1),attribute(tensor_field_2)),sum)");
assertTransformedExpression("min(constant(test_constant_tensor),1.0)",
- "min(test_constant_tensor,1.0)");
+ "min(test_constant_tensor,1.0)");
assertTransformedExpression("max(constant(base_constant_tensor),1.0)",
- "max(base_constant_tensor,1.0)");
+ "max(base_constant_tensor,1.0)");
assertTransformedExpression("min(constant(file_constant_tensor),1.0)",
- "min(constant(file_constant_tensor),1.0)");
+ "min(constant(file_constant_tensor),1.0)");
assertTransformedExpression("max(query(q),1.0)",
- "max(query(q),1.0)");
+ "max(query(q),1.0)");
assertTransformedExpression("max(query(n),1.0)",
- "max(query(n),1.0)");
+ "max(query(n),1.0)");
}
@Test
- public void requireThatMaxAndMinWithTensorAttributesAreReplaced() throws ParseException {
+ void requireThatMaxAndMinWithTensorAttributesAreReplaced() throws ParseException {
assertTransformedExpression("reduce(attribute(tensor_field_1),max,x)",
- "max(attribute(tensor_field_1),x)");
+ "max(attribute(tensor_field_1),x)");
assertTransformedExpression("1+reduce(attribute(tensor_field_1),max,x)",
- "1 + max(attribute(tensor_field_1),x)");
+ "1 + max(attribute(tensor_field_1),x)");
assertTransformedExpression("if(attribute(double_field),1+reduce(attribute(tensor_field_1),max,x),reduce(attribute(tensor_field_1),sum,x))",
- "if(attribute(double_field),1 + max(attribute(tensor_field_1),x),reduce(attribute(tensor_field_1), sum, x))");
+ "if(attribute(double_field),1 + max(attribute(tensor_field_1),x),reduce(attribute(tensor_field_1), sum, x))");
assertTransformedExpression("reduce(max(attribute(tensor_field_1),attribute(tensor_field_2)),max,x)",
- "max(max(attribute(tensor_field_1),attribute(tensor_field_2)),x)");
+ "max(max(attribute(tensor_field_1),attribute(tensor_field_2)),x)");
assertTransformedExpression("reduce(if(attribute(double_field),attribute(tensor_field_2),attribute(tensor_field_2)),max,x)",
- "max(if(attribute(double_field),attribute(tensor_field_2),attribute(tensor_field_2)),x)");
+ "max(if(attribute(double_field),attribute(tensor_field_2),attribute(tensor_field_2)),x)");
assertTransformedExpression("max(reduce(attribute(tensor_field_1),max,x),x)",
- "max(max(attribute(tensor_field_1),x),x)"); // will result in deploy error.
+ "max(max(attribute(tensor_field_1),x),x)"); // will result in deploy error.
assertTransformedExpression("reduce(reduce(attribute(tensor_field_2),max,x),max,y)",
- "max(max(attribute(tensor_field_2),x),y)");
+ "max(max(attribute(tensor_field_2),x),y)");
}
@Test
- public void requireThatMaxAndMinWithConstantTensorsAreReplaced() throws ParseException {
+ void requireThatMaxAndMinWithConstantTensorsAreReplaced() throws ParseException {
assertTransformedExpression("reduce(constant(test_constant_tensor),max,x)",
- "max(test_constant_tensor,x)");
+ "max(test_constant_tensor,x)");
assertTransformedExpression("reduce(constant(base_constant_tensor),max,x)",
- "max(base_constant_tensor,x)");
+ "max(base_constant_tensor,x)");
assertTransformedExpression("reduce(constant(file_constant_tensor),min,x)",
- "min(constant(file_constant_tensor),x)");
+ "min(constant(file_constant_tensor),x)");
}
@Test
- public void requireThatMaxAndMinWithTensorExpressionsAreReplaced() throws ParseException {
+ void requireThatMaxAndMinWithTensorExpressionsAreReplaced() throws ParseException {
assertTransformedExpression("reduce(attribute(double_field)+attribute(tensor_field_1),min,x)",
- "min(attribute(double_field) + attribute(tensor_field_1),x)");
+ "min(attribute(double_field) + attribute(tensor_field_1),x)");
assertTransformedExpression("reduce(attribute(tensor_field_1)*attribute(tensor_field_2),min,x)",
- "min(attribute(tensor_field_1) * attribute(tensor_field_2),x)");
+ "min(attribute(tensor_field_1) * attribute(tensor_field_2),x)");
assertTransformedExpression("reduce(join(attribute(tensor_field_1),attribute(tensor_field_2),f(x,y)(x*y)),min,x)",
- "min(join(attribute(tensor_field_1),attribute(tensor_field_2),f(x,y)(x*y)),x)");
+ "min(join(attribute(tensor_field_1),attribute(tensor_field_2),f(x,y)(x*y)),x)");
assertTransformedExpression("min(join(tensor_field_1,tensor_field_2,f(x,y)(x*y)),x)",
- "min(join(tensor_field_1,tensor_field_2,f(x,y)(x*y)),x)"); // because tensor fields are not in attribute(...)
+ "min(join(tensor_field_1,tensor_field_2,f(x,y)(x*y)),x)"); // because tensor fields are not in attribute(...)
assertTransformedExpression("reduce(join(attribute(tensor_field_1),backend_rank_feature,f(x,y)(x*y)),min,x)",
- "min(join(attribute(tensor_field_1),backend_rank_feature,f(x,y)(x*y)),x)");
+ "min(join(attribute(tensor_field_1),backend_rank_feature,f(x,y)(x*y)),x)");
}
@Test
- public void requireThatMaxAndMinWithTensorFromIsReplaced() throws ParseException {
+ void requireThatMaxAndMinWithTensorFromIsReplaced() throws ParseException {
assertTransformedExpression("reduce(tensorFromLabels(attribute(double_array_field)),max,double_array_field)",
- "max(tensorFromLabels(attribute(double_array_field)),double_array_field)");
+ "max(tensorFromLabels(attribute(double_array_field)),double_array_field)");
assertTransformedExpression("reduce(tensorFromLabels(attribute(double_array_field),x),max,x)",
- "max(tensorFromLabels(attribute(double_array_field),x),x)");
+ "max(tensorFromLabels(attribute(double_array_field),x),x)");
assertTransformedExpression("reduce(tensorFromWeightedSet(attribute(weightedset_field)),max,weightedset_field)",
- "max(tensorFromWeightedSet(attribute(weightedset_field)),weightedset_field)");
+ "max(tensorFromWeightedSet(attribute(weightedset_field)),weightedset_field)");
assertTransformedExpression("reduce(tensorFromWeightedSet(attribute(weightedset_field),x),max,x)",
- "max(tensorFromWeightedSet(attribute(weightedset_field),x),x)");
+ "max(tensorFromWeightedSet(attribute(weightedset_field),x),x)");
}
@Test
- public void requireThatMaxAndMinWithTensorInQueryIsReplaced() throws ParseException {
+ void requireThatMaxAndMinWithTensorInQueryIsReplaced() throws ParseException {
assertTransformedExpression("reduce(query(q),max,x)", "max(query(q),x)");
assertTransformedExpression("max(query(n),x)", "max(query(n),x)");
}
@Test
- public void requireThatMaxAndMinWithTensorsReturnedFromFunctionsAreReplaced() throws ParseException {
+ void requireThatMaxAndMinWithTensorsReturnedFromFunctionsAreReplaced() throws ParseException {
assertTransformedExpression("reduce(rankingExpression(returns_tensor),max,x)",
- "max(returns_tensor,x)");
+ "max(returns_tensor,x)");
assertTransformedExpression("reduce(rankingExpression(wraps_returns_tensor),max,x)",
- "max(wraps_returns_tensor,x)");
+ "max(wraps_returns_tensor,x)");
assertTransformedExpression("reduce(rankingExpression(tensor_inheriting),max,x)",
- "max(tensor_inheriting,x)");
+ "max(tensor_inheriting,x)");
assertTransformedExpression("reduce(rankingExpression(returns_tensor_with_arg@),max,x)",
- "max(returns_tensor_with_arg(attribute(tensor_field_1)),x)");
+ "max(returns_tensor_with_arg(attribute(tensor_field_1)),x)");
}
private void assertTransformedExpression(String expected, String original) throws ParseException {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java b/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
index 87bb2e96042..5f0940f0d2d 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
@@ -16,12 +16,13 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.documentmodel.SummaryField;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import java.util.Collections;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* @author bjorncs
*/
@@ -30,22 +31,18 @@ public class ValidateFieldTypesTest {
private static final String IMPORTED_FIELD_NAME = "imported_myfield";
private static final String DOCUMENT_NAME = "my_doc";
- @SuppressWarnings("deprecation")
- @Rule
- public final ExpectedException exceptionRule = ExpectedException.none();
-
@Test
- public void throws_exception_if_type_of_document_field_does_not_match_summary_field() {
- Schema schema = createSearchWithDocument(DOCUMENT_NAME);
- schema.setImportedFields(createSingleImportedField(IMPORTED_FIELD_NAME, DataType.INT));
- schema.addSummary(createDocumentSummary(IMPORTED_FIELD_NAME, DataType.STRING, schema));
+ void throws_exception_if_type_of_document_field_does_not_match_summary_field() {
+ Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
+ Schema schema = createSearchWithDocument(DOCUMENT_NAME);
+ schema.setImportedFields(createSingleImportedField(IMPORTED_FIELD_NAME, DataType.INT));
+ schema.addSummary(createDocumentSummary(IMPORTED_FIELD_NAME, DataType.STRING, schema));
- ValidateFieldTypes validator = new ValidateFieldTypes(schema, null, null, null);
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(
- "For schema '" + DOCUMENT_NAME + "', field '" + IMPORTED_FIELD_NAME + "': Incompatible types. " +
- "Expected int for summary field '" + IMPORTED_FIELD_NAME + "', got string.");
- validator.process(true, false);
+ ValidateFieldTypes validator = new ValidateFieldTypes(schema, null, null, null);
+ validator.process(true, false);
+ });
+ assertTrue(exception.getMessage().contains("For schema '" + DOCUMENT_NAME + "', field '" + IMPORTED_FIELD_NAME + "': Incompatible types. " +
+ "Expected int for summary field '" + IMPORTED_FIELD_NAME + "', got string."));
}
private static Schema createSearch(String documentType) {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/VespaMlModelTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/VespaMlModelTestCase.java
index 016e30e80af..dc72df9fc78 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/VespaMlModelTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/VespaMlModelTestCase.java
@@ -7,13 +7,13 @@ import com.yahoo.path.Path;
import com.yahoo.schema.derived.RawRankProfile;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.ml.ImportedModelTester;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Optional;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests adding Vespa ranking expression based models in the models/ dir
@@ -37,13 +37,13 @@ public class VespaMlModelTestCase {
/** The model name */
private final String name = "example";
- @After
+ @AfterEach
public void removeGeneratedModelFiles() {
IOUtils.recursiveDeleteDir(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
}
@Test
- public void testGlobalVespaModel() throws IOException {
+ void testGlobalVespaModel() throws IOException {
ImportedModelTester tester = new ImportedModelTester(name, applicationDir);
VespaModel model = tester.createVespaModel();
tester.assertLargeConstant("constant1asLarge", model, Optional.of(3L));
@@ -55,7 +55,7 @@ public class VespaMlModelTestCase {
storedAppDir.toFile().mkdirs();
IOUtils.copy(applicationDir.append("services.xml").toString(), storedAppDir.append("services.xml").toString());
IOUtils.copyDirectory(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile(),
- storedAppDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
+ storedAppDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
ImportedModelTester storedTester = new ImportedModelTester(name, storedAppDir);
VespaModel storedModel = storedTester.createVespaModel();
storedTester.assertLargeConstant("constant1asLarge", model, Optional.of(3L));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/WeightedSetSummaryToTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/WeightedSetSummaryToTestCase.java
index 2f62228cc3f..95d01946969 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/WeightedSetSummaryToTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/WeightedSetSummaryToTestCase.java
@@ -5,17 +5,17 @@ import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/** @author bratseth */
public class WeightedSetSummaryToTestCase extends AbstractSchemaTestCase {
@Test
- public void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
+ void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/weightedset-summaryto.sd");
assertNotNull(schema);
}