diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java')
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java index 929c407215a..8245119ffd7 100644 --- a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java @@ -13,17 +13,12 @@ import com.yahoo.schema.parser.ParseException; import com.yahoo.schema.processing.MakeAliases; import com.yahoo.vespa.documentmodel.SummaryTransform; import com.yahoo.vespa.model.container.search.QueryProfiles; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Iterator; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * Tests importing of search definitions @@ -34,7 +29,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { @Test @SuppressWarnings("deprecation") - public void testSimpleImporting() throws IOException, ParseException { + void testSimpleImporting() throws IOException, ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); ApplicationBuilder sb = new ApplicationBuilder(rankProfileRegistry, new QueryProfileRegistry()); sb.addSchemaFile("src/test/examples/simple.sd"); @@ -62,7 +57,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { assertEquals("aliaz", titleAliases.next()); assertEquals("analias.totitle", titleAliases.next()); assertEquals("analias.todefault", - schema.getIndex("default").aliasIterator().next()); + schema.getIndex("default").aliasIterator().next()); assertEquals(RankType.IDENTITY, field.getRankType()); assertEquals(0, field.getAttributes().size()); assertNull(field.getStemming()); @@ -72,9 +67,9 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { field = (SDField) document.getField("description"); assertEquals(RankType.ABOUT, field.getRankType()); assertEquals(SummaryTransform.NONE, - field.getSummaryField("description").getTransform()); + field.getSummaryField("description").getTransform()); assertEquals(SummaryTransform.DYNAMICTEASER, - field.getSummaryField("dyndesc").getTransform()); + field.getSummaryField("dyndesc").getTransform()); assertNull(field.getStemming()); assertTrue(field.getNormalizing().doRemoveAccents()); assertEquals("hallo", schema.getIndex("description").aliasIterator().next()); @@ -94,7 +89,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { // Fifth field field = (SDField) document.getField("popularity"); assertEquals("{ input popularity | attribute popularity; }", - field.getIndexingScript().toString()); + field.getIndexingScript().toString()); // Sixth field field = (SDField) document.getField("measurement"); @@ -105,17 +100,17 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { // Seventh field field = schema.getConcreteField("categories"); assertEquals("{ input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }", - field.getIndexingScript().toString()); + field.getIndexingScript().toString()); // Eight field - field= schema.getConcreteField("categoriesagain"); + field = schema.getConcreteField("categoriesagain"); assertEquals("{ input categoriesagain_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categoriesagain; }", - field.getIndexingScript().toString()); + field.getIndexingScript().toString()); // Ninth field - field= schema.getConcreteField("exactemento"); + field = schema.getConcreteField("exactemento"); assertEquals("{ input exactemento_src | lowercase | tokenize normalize stem:\"BEST\" | index exactemento | summary exactemento; }", - field.getIndexingScript().toString()); + field.getIndexingScript().toString()); // Tenth field field = schema.getConcreteField("category_arr"); @@ -140,12 +135,12 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { assertTrue(profile.inheritedNames().isEmpty()); assertNull(profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE)); assertEquals(RankType.EMPTY, - profile.getRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue()); + profile.getRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue()); profile = rankProfileRegistry.get(schema, "experimental"); assertNotNull(profile); assertEquals("default", profile.inheritedNames().get(0)); assertEquals(RankType.IDENTITY, - profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue()); + profile.getDeclaredRankSetting("measurement", RankProfile.RankSetting.Type.RANKTYPE).getValue()); profile = rankProfileRegistry.get(schema, "other"); assertNotNull(profile); @@ -153,17 +148,17 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { // The extra-document field SDField exact = schema.getConcreteField("exact"); - assertNotNull("Extra field was parsed", exact); + assertNotNull(exact, "Extra field was parsed"); assertEquals("exact", exact.getName()); assertEquals(Stemming.NONE, exact.getStemming()); assertFalse(exact.getNormalizing().doRemoveAccents()); assertEquals("{ input title . \" \" . input category | tokenize | summary exact | index exact; }", - exact.getIndexingScript().toString()); + exact.getIndexingScript().toString()); assertEquals(RankType.IDENTITY, exact.getRankType()); } @Test - public void testDocumentImporting() throws IOException, ParseException { + void testDocumentImporting() throws IOException, ParseException { try { // Having two documents in one sd-file is illegal. ApplicationBuilder.buildFromFile("src/test/examples/documents.sd"); @@ -173,9 +168,9 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { } @Test - public void testIdImporting() throws IOException, ParseException { + void testIdImporting() throws IOException, ParseException { Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/strange.sd"); - SDField idecidemyide = (SDField)schema.getDocument().getField("idecidemyide"); + SDField idecidemyide = (SDField) schema.getDocument().getField("idecidemyide"); assertEquals(5, idecidemyide.getId()); SDField sodoi = (SDField) schema.getDocument().getField("sodoi"); assertEquals(7, sodoi.getId()); |