Search in sources :

Example 1 with WhitespaceTokenizer

use of org.apache.flink.util.StringValueUtils.WhitespaceTokenizer in project flink by apache.

the class StringValueUtilsTest method testTokenizerOnStringWithNexToken.

@Test
public void testTokenizerOnStringWithNexToken() {
    StringValue testString = new StringValue("test test");
    StringValueUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    assertTrue(tokenizer.next(testString));
}
Also used : WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) StringValue(org.apache.flink.types.StringValue) WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) Test(org.junit.Test)

Example 2 with WhitespaceTokenizer

use of org.apache.flink.util.StringValueUtils.WhitespaceTokenizer in project flink by apache.

the class StringValueUtilsTest method testTokenizerOnStringOnlyWithDelimiter.

@Test
public void testTokenizerOnStringOnlyWithDelimiter() {
    StringValue testString = new StringValue("    ");
    StringValueUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    assertFalse(tokenizer.next(testString));
}
Also used : WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) StringValue(org.apache.flink.types.StringValue) WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) Test(org.junit.Test)

Example 3 with WhitespaceTokenizer

use of org.apache.flink.util.StringValueUtils.WhitespaceTokenizer in project flink by apache.

the class StringValueUtilsTest method testTokenizerOnStringWithoutNexToken.

@Test
public void testTokenizerOnStringWithoutNexToken() {
    StringValue testString = new StringValue("test");
    StringValueUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    // first token
    tokenizer.next(testString);
    // next token is not exist
    assertFalse(tokenizer.next(testString));
}
Also used : WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) StringValue(org.apache.flink.types.StringValue) WhitespaceTokenizer(org.apache.flink.util.StringValueUtils.WhitespaceTokenizer) Test(org.junit.Test)

Aggregations

StringValue (org.apache.flink.types.StringValue)3 WhitespaceTokenizer (org.apache.flink.util.StringValueUtils.WhitespaceTokenizer)3 Test (org.junit.Test)3