@Test
public void testComposeTry0() {

    final List<Exception> collectedErrors = new ArrayList<>();
    final AtomicInteger latch = new AtomicInteger(0);
    final Fun.ThrowingSupplier<Integer> supplier = () -> {
        int newValue = latch.incrementAndGet();
        if (newValue % 3 == 0) {
            throw new Exception("multiples of three are disallowed");
        }
        return newValue;
    };
    Integer[] ints = Stream.generate(composeTry0(Stream::of, Stream::empty, supplier, collectedErrors::add))
            .limit(10).flatMap(Function.identity())
            .toArray(Integer[]::new);
    assertEquals("collected three errors", 3, collectedErrors.size());
    latch.set(0);
    Integer[] ints2 = Stream.generate(composeTry0(Stream::of, Stream::empty, supplier, null))
            .limit(10).flatMap(Function.identity())
            .toArray(Integer[]::new);
    assertArrayEquals("ints should contain no multiples of 3, up to ten 10",
            new Integer[]{1, 2, 4, 5, 7, 8, 10}, ints2);
}