    @Test(expected = IOException.class)
    public void handlesIOException() throws Exception {

        final InputStream inputStream = mock(InputStream.class);
        when(inputStream.available()).thenReturn(1000);
        doThrow(IOException.class).when(inputStream).read(any(byte[].class), anyInt(), anyInt());
        final FormatReader reader = new LDIFFormatReader(inputStream);
        reader.nextRecord();
    }