aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java b/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
new file mode 100644
index 00000000000..03f9d7c5960
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
@@ -0,0 +1,30 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.schema.processing;
+
+import com.yahoo.schema.ApplicationBuilder;
+import com.yahoo.schema.parser.ParseException;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.fail;
+
+/**
+ * @author hmusum
+ */
+public class SchemaMustHaveDocumentTest {
+
+ @Test
+ public void requireErrorWhenMissingDocument() throws IOException, ParseException {
+ try {
+ ApplicationBuilder.buildFromFile("src/test/examples/invalid_sd_missing_document.sd");
+ fail("SD without document");
+ } catch (IllegalArgumentException e) {
+ if (!e.getMessage()
+ .contains("For schema 'imageconfig': A search specification must have an equally named document inside of it.")) {
+ throw e;
+ }
+ }
+ }
+
+}