blob: 1a92f5a750e034478a390f93604dd219e5dd21a4 (
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
37
38
|
// Copyright 2016 Yahoo Inc. 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 <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
*/
public class TokenTypeTestCase {
@Test
@SuppressWarnings("deprecation")
public void requireThatValueOfWorks() {
for (TokenType type : TokenType.values()) {
assertEquals(type, TokenType.valueOf(type.getValue()));
}
}
@Test
@SuppressWarnings("deprecation")
public void requireThatValueOfUnknownIsUnknown() {
assertEquals(TokenType.UNKNOWN, TokenType.valueOf(-1));
}
@Test
public void requireThatOnlyAlphaNumericsAreIndexable() {
for (TokenType type : TokenType.values()) {
if (type == TokenType.ALPHABETIC || type == TokenType.NUMERIC) {
assertTrue(type.isIndexable());
} else {
assertFalse(type.isIndexable());
}
}
}
}
|