@Test
public void testTryOrOptional0() {

    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<Optional<Integer>> results = Stream.generate(tryOrOptional0(supplier)).limit(10)
            .collect(Collectors.toList());
    Integer[] ints = results.stream().map(element -> element.orElse(0)).toArray(Integer[]::new);
    assertArrayEquals("ints contains three zeros, 1 for each multiple of 3",
            new Integer[]{1, 2, 0, 4, 5, 0, 7, 8, 0, 10}, ints);
}