Improve testing, add test for creating stream.
Refactor mocking in test to use decorators.