@Test
public void testWriteToThrowException() throws IOException {

    final OutputStream out = new ByteArrayOutputStream();
    final IOException expectedException = new IOException("expected IO exception");
    doThrow(expectedException).when(innerFilter).writeTo(out);
    assertThatThrownBy(() -> wrapper.writeTo(out)).isSameAs(expectedException);
    verify(innerFilter, times(1)).writeTo(out);
}