aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/processing/SchemaMustHaveDocumentTest.java
blob: 6e5e17398d9a9bd1ed5b04b252205322fabb087a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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.jupiter.api.Test;

import java.io.IOException;

import static org.junit.jupiter.api.Assertions.fail;

/**
 * @author hmusum
 */
public class SchemaMustHaveDocumentTest {

    @Test
    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;
            }
        }
    }

}