@Test
public void testResult0() {

    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;
    };
    final List<Result<Integer>> results = Stream.generate(result0(supplier)).limit(10).collect(Collectors.toList());
    assertEquals("results should have three failures", 3, results.stream().filter(Result::isFailure).count());
    final Integer[] ints = results.stream().flatMap(Result::stream).toArray(Integer[]::new);
    assertArrayEquals("ints should contain no multiples of 3, up to ten 10",
            new Integer[]{1, 2, 4, 5, 7, 8, 10}, ints);
}