Improve test to cover input from a stream