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

import com.yahoo.schema.Schema;
import com.yahoo.schema.ApplicationBuilder;
import com.yahoo.schema.AbstractSchemaTestCase;
import com.yahoo.schema.parser.ParseException;
import org.junit.jupiter.api.Test;

import java.io.IOException;

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

/**
 * Correct casing for derived attributes
 *
 * @author vegardh
 */
public class CasingTestCase extends AbstractSchemaTestCase {

    @Test
    void testCasing() throws IOException, ParseException {
        Schema schema = ApplicationBuilder.buildFromFile("src/test/examples/casing.sd");
        assertEquals(schema.getIndex("color").getName(), "color");
        assertEquals(schema.getIndex("Foo").getName(), "Foo");
        assertEquals(schema.getIndex("Price").getName(), "Price");
        assertEquals(schema.getAttribute("artist").getName(), "artist");
        assertEquals(schema.getAttribute("Drummer").getName(), "Drummer");
        assertEquals(schema.getAttribute("guitarist").getName(), "guitarist");
        assertEquals(schema.getAttribute("title").getName(), "title");
        assertEquals(schema.getAttribute("Trumpetist").getName(), "Trumpetist");
        assertEquals(schema.getAttribute("Saxophonist").getName(), "Saxophonist");
        assertEquals(schema.getAttribute("TenorSaxophonist").getName(), "TenorSaxophonist");
        assertEquals(schema.getAttribute("Flutist").getName(), "Flutist");
    }
}