### Question:
Result { T orElseGet(Supplier<? extends T> supplier) { return isPresent() ? value : supplier.get(); } private  Result(T value, E err); static Result<T, E> of(T value); static Result<T, E> error(E err); T get(); E getErr(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testOrElseGet() { final AtomicBoolean check = new AtomicBoolean(false); Supplier<Integer> supplier = new Supplier<Integer>() { @Override public Integer get() { check.set(true); return 24; } }; Integer valueRes = Result.of(42).orElseGet(supplier); assertThat("valueRes get result value", valueRes, is(42)); assertThat("Supplier is not called", check.get(), is(false)); check.set(false); Integer errorRes = Result.<Integer, Integer>error(42).orElseGet(supplier); assertThat("errorRes get else value", errorRes, is(24)); assertThat("Supplier is called", check.get(), is(true)); }