aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/processing/IndexingValuesTestCase.java
blob: 2784fe69b2838e540fbdf0a3fe1d8c70a1e6311b (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.parser.ParseException;
import org.junit.Test;

import java.io.IOException;

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

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

    @Test
    public void requireThatModifyFieldNoOutputDoesNotThrow() throws IOException, ParseException {
        assertBuilds("src/test/examples/indexing_modify_field_no_output.sd");
    }

    @Test
    public void requireThatInputOtherFieldThrows() throws IOException, ParseException {
        assertBuildFails("src/test/examples/indexing_input_other_field.sd",
                         "For schema 'indexing_input_other_field', field 'bar': Indexing expression 'input foo' " +
                         "attempts to modify the value of the document field 'bar'. " +
                         "Use a field outside the document block instead.");
    }

}