aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query/profile/types/test/FieldTypeTestCase.java
blob: 0ace8f93f1d58362196dd6473b0ed142f30defd3 (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.Test;

import static org.junit.Assert.assertEquals;

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

    @Test
    public 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());
    }

}