diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-28 14:44:47 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2022-07-28 14:51:35 +0200 |
commit | 695209a356ecae42536fd394189a98cf5274518e (patch) | |
tree | fff14a30ce9efde18a83d15ff08bbdb672119477 /config-model/src/test/java/com/yahoo/schema/derived | |
parent | 9dab1e67022884f6644b3d8c9b02c6b3c466a879 (diff) |
Convert config-model to junit5
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema/derived')
51 files changed, 378 insertions, 374 deletions
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); |