Tokenizers { public static Tokenizer qGramWithPadding(int q) { return new QGramExtended(q); } private  Tokenizers(); static Tokenizer pattern(Pattern pattern); static Tokenizer pattern(String regex); static Tokenizer qGram(int q); static Tokenizer qGramWithFilter(int q); static Tokenizer qGramWithPadding(int q); static Tokenizer qGramWithPadding(int q, String padding); static Tokenizer qGramWithPadding(int q, String startPadding,
			String endPadding); static Tokenizer whitespace(); static Tokenizer transform(Tokenizer tokenizer,
			Function<String, String> function); static Tokenizer chain(List<Tokenizer> tokenizers); static Tokenizer chain(Tokenizer tokenizer, Tokenizer... tokenizers); static Tokenizer filter(Tokenizer tokenizer,
			Predicate<String> predicate);  }
@Test public void shouldReturnQGramWithPadding() { Tokenizer tokenizer = Tokenizers.qGramWithPadding(3); assertEquals(QGramExtended.class, tokenizer.getClass()); QGramExtended qGram = (QGramExtended) tokenizer; assertEquals(3, qGram.getQ()); assertEquals("##", qGram.getStartPadding()); assertEquals("##", qGram.getEndPadding()); }
@Test public void shouldReturnQGramWithCustomPadding() { Tokenizer tokenizer = Tokenizers.qGramWithPadding(3, "@"); assertEquals(QGramExtended.class, tokenizer.getClass()); QGramExtended qGram = (QGramExtended) tokenizer; assertEquals(3, qGram.getQ()); assertEquals("@@", qGram.getStartPadding()); assertEquals("@@", qGram.getEndPadding()); }
@Test public void shouldReturnQGramWithCustomStartAndEndPadding() { Tokenizer tokenizer = Tokenizers.qGramWithPadding(3, "^", "$"); assertEquals(QGramExtended.class, tokenizer.getClass()); QGramExtended qGram = (QGramExtended) tokenizer; assertEquals(3, qGram.getQ()); assertEquals("^^", qGram.getStartPadding()); assertEquals("$$", qGram.getEndPadding()); }