Unit test IOException for InputStream
<p>Is there a way to unit test the following code without using <strong>PowerMock</strong>? We have sonar unit test code coverage and it does not recognise code tested via PowerMockRunner. So I was looking for a way to simulate <strong>IOException</strong> or use Mockito somehow to test this code so that it throws exception.</p>

<pre><code>public void readFile(byte[] bytes) {    
    try (final InputStream inputStream = new ByteArrayInputStream(bytes)) {
       .....
    } catch (IOException e) {
        throw new SystemException("Error reading file");
    }
}



@Test(expected = SystemException.class)
public void testException {
}
</code></pre>

<p>Any suggestion would be great.</p>

<p>Thanks.</p>