@Test
public void testClosesThrowsError() throws Exception {

    InputStream is = Mockito.mock(InputStream.class);
    Mockito.doThrow(new IOException("throwing for test")).when(is).close();
    IOUtils.close(is);
    Mockito.verify(is, Mockito.times(1)).close();
}