refactor stream test