aboutsummaryrefslogtreecommitdiffstats
path: root/linguistics/src/test/java/com/yahoo/language/process/TokenTypeTestCase.java
blob: 70a97cda7e31b339845616aa10c2913abcca6b5e (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.language.process;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author Simon Thoresen Hult
 */
public class TokenTypeTestCase {

    @Test
    public void requireThatValueOfWorks() {
        for (TokenType type : TokenType.values()) {
            assertEquals(type, TokenType.valueOf(type.getValue()));
        }
    }

    @Test
    public void requireThatValueOfUnknownIsUnknown() {
        assertEquals(TokenType.UNKNOWN, TokenType.valueOf(-1));
    }

    @Test
    public void testIsIndexable() {
        for (TokenType type : TokenType.values()) {
            if (type == TokenType.ALPHABETIC || type == TokenType.NUMERIC || type == TokenType.INDEXABLE_SYMBOL) {
                assertTrue(type.isIndexable());
            } else {
                assertFalse(type.isIndexable());
            }
        }
    }

}