Produce { public boolean hasError() { return !hasResult(); } 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 hasError() { Assertions.assertFalse(WITH_RESULT.hasError()); Assertions.assertTrue(WITHOUT_RESULT.hasError()); }