### Question:
LDIFFormatReader implements FormatReader { public LDIFChangeRecord nextRecord() throws IOException, LDIFException { return reader.readChangeRecord(); } LDIFFormatReader(final InputStream inputStream); LDIFChangeRecord nextRecord(); void close();  }### Answer:
@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(); }