Produce { public boolean hasResult() { return result != null; } private  Produce(T result, Supplier<E> error);  Produce(T result);  Produce(Supplier<E> error); void ifPresent(Consumer<T> consumer); boolean hasResult(); boolean hasError(); @Nullable E getError(); T getResult();  }
@Test void hasResult() { Assertions.assertTrue(WITH_RESULT.hasResult()); Assertions.assertFalse(WITHOUT_RESULT.hasResult()); }