BufferedReaderAdapter { public Consumer<BufferedReader> close() { return (reader) -> { try { reader.close(); } catch (final IOException e) { throw new FileHandlingException("Error while closing document location!", e); } }; }  Function<BufferedReader, Flux<String>> consume(); Consumer<BufferedReader> close();  }
@Test @SneakyThrows public void testCloseWhenNoExceptionThrown() { bufferedReaderAdapter.close().accept(bufferedReaderMock); verify(bufferedReaderMock, only()).close(); }
@Test @SneakyThrows public void testCloseWhenExceptionThrown() { doThrow(new RuntimeException()).when(bufferedReaderMock).close(); assertThrows(RuntimeException.class, () -> bufferedReaderAdapter.close().accept(bufferedReaderMock)); }