@Test
public void testThrowingOnNullStreams() throws IOException {

    @SuppressWarnings("unchecked")
    Iterator<InputStream> inputStreams = mock(Iterator.class);
    when(inputStreams.hasNext()).thenReturn(true, false);
    when(inputStreams.next()).thenReturn(null);
    ConcatClosingInputStream concatClosingInputStream = new ConcatClosingInputStream(inputStreams);
    expectedException.expect(IOException.class);
    expectedException.expectMessage("cannot read from null Stream");
    @SuppressWarnings("unused")
    int unused = concatClosingInputStream.read();
    fail("expected exception");
}