Extract assertFilteredTokens function in test