Best way to test a method that works with streams : <p>I got this method </p>

<pre><code>    void sort(InputStream in, OutputStream out, Comparator&lt;?&gt; comparator) throws IOException;
</code></pre>

<p>that sorts the input stream (XML data) in the output stream (same format) according to the provided comparator.</p>

<p>Since I am a beginner with Junit, how would you test this method? It would be great if you can provide some code snippet.</p>
