// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// @Deprecated
// public static <A, B, R, E extends Throwable> Optional<R> flatMapBoth(
//     Optional<A> left, Optional<B> right,
//     CheckedBiFunction<? super A, ? super B, ? extends Optional<R>, E> mapper)
//     throws E {
//   requireNonNull(left);
//   requireNonNull(right);
//   requireNonNull(mapper);
//   if (left.isPresent() && right.isPresent()) {
//     return requireNonNull(mapper.apply(left.get(), right.get()));
//   }
//   return Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <E extends Throwable> Premise ifPresent(
//     OptionalInt optional, CheckedIntConsumer<E> consumer) throws E {
//   requireNonNull(optional);
//   requireNonNull(consumer);
//   if (optional.isPresent()) {
//     consumer.accept(optional.getAsInt());
//     return Conditional.TRUE;
//   } else {
//     return Conditional.FALSE;
//   }
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// @Deprecated
// public static <A, B, R, E extends Throwable> Optional<R> mapBoth(
//     Optional<A> left, Optional<B> right, CheckedBiFunction<? super A, ? super B, ? extends R, E> mapper)
//     throws E {
//   requireNonNull(left);
//   requireNonNull(right);
//   requireNonNull(mapper);
//   if (left.isPresent() && right.isPresent()) {
//     return Optional.ofNullable(mapper.apply(left.get(), right.get()));
//   }
//   return Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <T> Optional<T> optional(boolean condition, T value) {
//   return condition ? Optional.ofNullable(value) : Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <T, E extends Throwable> Optional<T> optionally(
//     boolean condition, CheckedSupplier<? extends T, E> supplier) throws E {
//   requireNonNull(supplier);
//   return condition ? Optional.ofNullable(supplier.get()) : Optional.empty();
// }


import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.mu.util.Optionals.flatMapBoth;
import static com.google.mu.util.Optionals.ifPresent;
import static com.google.mu.util.Optionals.mapBoth;
import static com.google.mu.util.Optionals.optional;
import static com.google.mu.util.Optionals.optionally;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import com.google.common.testing.NullPointerTester;
package com.google.mu.util;





@RunWith(JUnit4.class)
public class OptionalsTest {
  @Mock private BiAction action;
  @Mock private Consumer<Object> consumer;
  @Mock private Runnable otherwise;

  @Before public void setUpMocks() {
    MockitoAnnotations.initMocks(this);
  }

  @Test public void optionally_empty() {
    assertThat(
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// @Deprecated
// public static <A, B, R, E extends Throwable> Optional<R> flatMapBoth(
//     Optional<A> left, Optional<B> right,
//     CheckedBiFunction<? super A, ? super B, ? extends Optional<R>, E> mapper)
//     throws E {
//   requireNonNull(left);
//   requireNonNull(right);
//   requireNonNull(mapper);
//   if (left.isPresent() && right.isPresent()) {
//     return requireNonNull(mapper.apply(left.get(), right.get()));
//   }
//   return Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <E extends Throwable> Premise ifPresent(
//     OptionalInt optional, CheckedIntConsumer<E> consumer) throws E {
//   requireNonNull(optional);
//   requireNonNull(consumer);
//   if (optional.isPresent()) {
//     consumer.accept(optional.getAsInt());
//     return Conditional.TRUE;
//   } else {
//     return Conditional.FALSE;
//   }
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// @Deprecated
// public static <A, B, R, E extends Throwable> Optional<R> mapBoth(
//     Optional<A> left, Optional<B> right, CheckedBiFunction<? super A, ? super B, ? extends R, E> mapper)
//     throws E {
//   requireNonNull(left);
//   requireNonNull(right);
//   requireNonNull(mapper);
//   if (left.isPresent() && right.isPresent()) {
//     return Optional.ofNullable(mapper.apply(left.get(), right.get()));
//   }
//   return Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <T> Optional<T> optional(boolean condition, T value) {
//   return condition ? Optional.ofNullable(value) : Optional.empty();
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Optionals.java
// public static <T, E extends Throwable> Optional<T> optionally(
//     boolean condition, CheckedSupplier<? extends T, E> supplier) throws E {
//   requireNonNull(supplier);
//   return condition ? Optional.ofNullable(supplier.get()) : Optional.empty();
// }


// Path: mug/src/test/java/com/google/mu/util/OptionalsTest.java
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.mu.util.Optionals.flatMapBoth;
import static com.google.mu.util.Optionals.ifPresent;
import static com.google.mu.util.Optionals.mapBoth;
import static com.google.mu.util.Optionals.optional;
import static com.google.mu.util.Optionals.optionally;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import com.google.common.testing.NullPointerTester;

package com.google.mu.util;





@RunWith(JUnit4.class)
public class OptionalsTest {
  @Mock private BiAction action;
  @Mock private Consumer<Object> consumer;
  @Mock private Runnable otherwise;

  @Before public void setUpMocks() {
    MockitoAnnotations.initMocks(this);
  }

  @Test public void optionally_empty() {
    assertThat(
            optionally(