### Question:
CompletionTokenizer { public List<Token> tokenizeSubstring(String input, int beginIndex, int rightBound) { TokensCollector tc = new TokensCollector(); for (int i = beginIndex; i < rightBound; i++) { tc.append(input.charAt(i)); } tc.collectLastToken(); return tc.tokens; } CompletionTokenizer(TokenCompletion spec); List<Token> tokenize(String input); List<Token> tokenizeSubstring(String input, int beginIndex, int rightBound);  }### Answer:
@Test public void tokenizeSubstringWithWholeTokens() { List<Token> tokens = tokenizer.tokenizeSubstring("1 + 2 + 3", 2, 6); assertTokensEqual(of(PLUS, integer(2)), tokens); }
@Test public void tokenizeSubstringWithTokenParts() { List<Token> tokens = tokenizer.tokenizeSubstring("123 + 789", 2, 8); assertTokensEqual(of(integer(3), PLUS, integer(78)), tokens); }