Imagine that you have a method that requires an
InputStream, and you want to test that method. How can you test it?
In the Scala Cookbook I wrote how your method can accept a
Source instead of a
File to make it easier to test, so I won’t write any more about that right now.
But if you have a method that accepts an
InputStream and you want to be able to test it with a
String, here’s what you can do: