@Test
public void testWriteToStream_throwingSupplier() throws Exception {

    OutputStream mockOs = mock(OutputStream.class);
    doThrow(IllegalStateException.class).when(mockOs).write(any(byte[].class));
    Result<Nothing> result = Options.writeToStream(new byte[0], () -> mockOs);
    assertTrue("expect failure", result.isFailure());
    assertTrue("expect same exception", result.findCause(IllegalStateException.class).isPresent());
}