aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/processing/IndexingInputsTestCase.java
blob: d420623f23325b432f3332d1c6b5bddb652ae5b6 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 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.parser.ParseException;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static com.yahoo.schema.processing.AssertSearchBuilder.assertBuildFails;

/**
 * @author Simon Thoresen Hult
 */
public class IndexingInputsTestCase {

    @Test
    void requireThatExtraFieldInputExtraFieldThrows() throws IOException, ParseException {
        assertBuildFails("src/test/examples/indexing_extra_field_input_extra_field.sd",
                "For schema 'indexing_extra_field_input_extra_field', field 'bar': Indexing script refers " +
                        "to field 'bar' which is neither a field in document type " +
                        "'indexing_extra_field_input_extra_field' nor a mutable attribute");
    }

    @Test
    void requireThatExtraFieldInputImplicitThrows() throws IOException, ParseException {
        assertBuildFails("src/test/examples/indexing_extra_field_input_implicit.sd",
                "For schema 'indexing_extra_field_input_implicit', field 'foo': Indexing script refers to " +
                        "field 'foo' which is neither a field in document type 'indexing_extra_field_input_implicit' nor a mutable attribute");
    }

    @Test
    void requireThatExtraFieldInputNullThrows() throws IOException, ParseException {
        assertBuildFails("src/test/examples/indexing_extra_field_input_null.sd",
                "For schema 'indexing_extra_field_input_null', field 'foo': Indexing script refers to field " +
                        "'foo' which is neither a field in document type 'indexing_extra_field_input_null' nor a mutable attribute");
    }

    @Test
    void requireThatExtraFieldInputSelfThrows() throws IOException, ParseException {
        assertBuildFails("src/test/examples/indexing_extra_field_input_self.sd",
                "For schema 'indexing_extra_field_input_self', field 'foo': Indexing script refers to field " +
                        "'foo' which is neither a field in document type 'indexing_extra_field_input_self' nor a mutable attribute");
    }

}