aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema/UrlFieldValidationTestCase.java
blob: 1509ca0bf9b95e48a62a9e0654b11e5e8517ba67 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema;

import com.yahoo.schema.parser.ParseException;
import com.yahoo.yolean.Exceptions;
import org.junit.jupiter.api.Test;

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

/**
 * @author bratseth
 */
public class UrlFieldValidationTestCase {

    @Test
    void requireThatInheritedRiseFieldsStillCanBeInConflictButDontThrowException() throws ParseException {
        ApplicationBuilder builder = new ApplicationBuilder();
        builder.addSchema("search test {" +
                "    document test { " +
                "        field a type uri { indexing: attribute | summary }" +
                "    }" +
                "}");
        try {
            builder.build(true);
            fail("Should have caused an exception");
            // success
        } catch (IllegalArgumentException e) {
            assertEquals("Error in field 'a' in schema 'test': uri type fields cannot be attributes",
                    Exceptions.toMessageString(e));
        }
    }

}