### Question:
Optionals { public static <T> Optional<T> optional(boolean condition, T value) { return condition ? Optional.ofNullable(value) : Optional.empty(); } private  Optionals(); static Optional<T> optionally(
      boolean condition, CheckedSupplier<? extends T, E> supplier); static Optional<T> optional(boolean condition, T value); static Premise ifPresent(
      OptionalInt optional, CheckedIntConsumer<E> consumer); static Premise ifPresent(
      OptionalLong optional, CheckedLongConsumer<E> consumer); static Premise ifPresent(
      OptionalDouble optional, CheckedDoubleConsumer<E> consumer); static Premise ifPresent(
      Optional<T> optional, CheckedConsumer<? super T, E> consumer); static Premise ifPresent(
      Optional<A> left, Optional<B> right, CheckedBiConsumer<? super A, ? super B, E> consumer); static Optional<R> mapBoth(
      Optional<A> left, Optional<B> right, CheckedBiFunction<? super A, ? super B, ? extends R, E> mapper); static Optional<R> flatMapBoth(
      Optional<A> left, Optional<B> right,
      CheckedBiFunction<? super A, ? super B, ? extends Optional<R>, E> mapper);  }### Answer:
@Test public void optional_empty() { assertThat(optional(false, "whatever")).isEmpty(); assertThat(optional(false, null)).isEmpty(); }
@Test public void optional_nullValueIsTranslatedToEmpty() { assertThat(optional(true, null)).isEmpty(); }
@Test public void optional_notEmpty() { assertThat(optional(true, "v")).hasValue("v"); }