summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/IncorrectSummaryTypesTestCase.java
blob: b6e3dc1b44295b9a8b0088e831d384c420ab52cf (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;

import com.yahoo.searchdefinition.parser.ParseException;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
 * Tests importing a search definition with conflicting summary types
 *
 * @author <a href="bratseth@yahoo-inc.com">Jon Bratseth</a>
 */
public class IncorrectSummaryTypesTestCase extends SearchDefinitionTestCase {
    @Test
    public void testImportingIncorrect() throws IOException, ParseException {
        try {
            SearchBuilder.buildFromFile("src/test/examples/incorrectsummarytypes.sd");
            fail("processing should have failed");
        } catch (RuntimeException e) {
            assertEquals("'summary somestring type string' in 'destinations(default )' is inconsistent with 'summary somestring type int' in 'destinations(incorrect )': All declarations of the same summary field must have the same type", e.getMessage());
        }
    }

}