aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query/profile/types/test/FieldTypeTestCase.java
blob: b245648b8615d2231f49d7f3fbf6ce2700b7bbe3 (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.types.test;

import com.yahoo.search.query.profile.types.FieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;
import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry;
import org.junit.jupiter.api.Test;

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

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

    @Test
    void testConvertToFromString() {
        QueryProfileTypeRegistry registry = new QueryProfileTypeRegistry();
        registry.register(new QueryProfileType("foo"));

        assertEquals("string", FieldType.fromString("string", registry).stringValue());
        assertEquals("boolean", FieldType.fromString("boolean", registry).stringValue());
        assertEquals("query-profile", FieldType.fromString("query-profile", registry).stringValue());
        assertEquals("query-profile:foo", FieldType.fromString("query-profile:foo", registry).stringValue());
    }

}