public class TokenStreamStringConcatenatorTest {
@Test
public void testTokenStreamToStringWithDelimiter() throws Exception{
TokenStreamStringConcatenator tokenStreamStringConcatenator = new TokenStreamStringConcatenator();
Collection<Token> tokens1 = new ArrayList<Token>();
tokens1.add(new Token("token1".toCharArray(),0,6,0,6));
tokens1.add(new Token("token2".toCharArray(),0,6,7,13));
tokens1.add(new Token("token3".toCharArray(),0,6,14,20));
CollectionTokenStream tokenStream1 = new CollectionTokenStream(tokens1);
String concatenatedString = tokenStreamStringConcatenator.tokenStreamToStringWithDelimiter(tokenStream1, " ");
assertEquals("token1 token2 token3", concatenatedString);
}