Added InputStream injection and test cases to go with it.