diff options
author | Harald Musum <musum@yahooinc.com> | 2024-05-29 15:48:03 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2024-05-29 15:48:03 +0200 |
commit | 060e2353bf92e7b6933ad6e6b91ba9ffd8a59230 (patch) | |
tree | c0f7f1393b37e1d2097951ce969c61701dc136a4 /config-model/src/test/java/com/yahoo | |
parent | 943036c7096b2e971f2500fe0685c388f2d7aa05 (diff) |
Throw if inheriting non-existent document summary
Special handling of inheriting default, which I assume will always be ok
Diffstat (limited to 'config-model/src/test/java/com/yahoo')
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java | 15 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java | 8 |
2 files changed, 7 insertions, 16 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java index 8ffbab84fd7..539ec91ee5f 100644 --- a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java @@ -6,16 +6,13 @@ import com.yahoo.vespa.documentmodel.DocumentSummary; import com.yahoo.vespa.model.test.utils.DeployLoggerStub; import com.yahoo.vespa.objects.FieldBase; import com.yahoo.yolean.Exceptions; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static com.yahoo.config.model.test.TestUtil.joinLines; import java.util.Collection; import java.util.List; -import java.util.Optional; import java.util.logging.Level; -import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.*; @@ -233,16 +230,12 @@ public class SummaryTestCase { " document-summary test_summary inherits nonesuch {" + " }" + "}"); - DeployLoggerStub logger = new DeployLoggerStub(); - ApplicationBuilder.createFromStrings(logger, schema); - assertEquals("document-summary 'test_summary' inherits 'nonesuch' but this is not present in schema 'test'", - logger.entries.get(0).message); - // fail("Expected failure"); + ApplicationBuilder.createFromString(schema); + fail("Expected failure"); } catch (IllegalArgumentException e) { - fail(); - // assertEquals("document-summary 'test_summary' inherits nonesuch but this is not present in schema 'test'", - // e.getMessage()); + assertEquals("document-summary 'test_summary' inherits 'nonesuch', but this is not present in schema 'test'", + e.getMessage()); } } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java index 1184e49b381..5ea097f13fb 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java @@ -5,11 +5,11 @@ import com.yahoo.schema.Schema; import com.yahoo.schema.ApplicationBuilder; import com.yahoo.schema.parser.ParseException; import com.yahoo.vespa.documentmodel.SummaryTransform; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static com.yahoo.config.model.test.TestUtil.joinLines; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class SummaryConsistencyTestCase { @@ -45,8 +45,7 @@ public class SummaryConsistencyTestCase { } @Test - @Disabled - void testDocumentTypesWithInheritanceOfNonExistingField() throws ParseException { + void testDocumentSummaryWithInheritanceOfNonExistingSummary() { String schemaString = """ schema foo { document foo { @@ -61,8 +60,7 @@ public class SummaryConsistencyTestCase { } } """; - var schema = ApplicationBuilder.createFromString(schemaString).getSchema(); - schema.getSummaryField("foo_summary"); + assertThrows(IllegalArgumentException.class, () -> ApplicationBuilder.createFromString(schemaString).getSchema()); } } |