// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SuppressWarnings("unchecked")
// static <T> Selection<T> all() {
//   return (Selection<T>) Selections.ALL;
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Selection<T> nonEmptyOrAll(Collection<? extends T> choices) {
//   return choices.isEmpty() ? all() : choices.stream().collect(toSelection());
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SuppressWarnings("unchecked")
// static <T> Selection<T> none() {
//   return (Selection<T>) Selections.NONE;
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SafeVarargs
// static <T> Selection<T> only(T... choices) {
//   return Arrays.stream(choices).collect(toSelection());
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<Selection<T>, ?, Selection<T>> toIntersection() {
//   return reducing(all(), Selection::intersect);
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<T, ?, Selection<T>> toSelection() {
//   return collectingAndThen(toImmutableSet(), Selections::explicit);
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<Selection<T>, ?, Selection<T>> toUnion() {
//   return reducing(none(), Selection::union);
// }


import org.junit.runners.JUnit4;
import com.google.common.collect.ImmutableSet;
import com.google.common.testing.EqualsTester;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.mu.util.Selection.all;
import static com.google.mu.util.Selection.nonEmptyOrAll;
import static com.google.mu.util.Selection.none;
import static com.google.mu.util.Selection.only;
import static com.google.mu.util.Selection.toIntersection;
import static com.google.mu.util.Selection.toSelection;
import static com.google.mu.util.Selection.toUnion;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.runner.RunWith;
  @Test public void only_has() {
    assertThat(only("foo").has("foo")).isTrue();
    assertThat(only("foo").has("bar")).isFalse();
    assertThat(only("foo").has(null)).isFalse();
  }

  @Test public void only_isEmpty() {
    assertThat(only("foo").isEmpty()).isFalse();
  }

  @Test public void only_union() {
    assertThat(only("foo").union(only("bar"))).isEqualTo(only("foo", "bar"));
    assertThat(only("foo").union(only("bar")).limited().get())
        .containsExactly("foo", "bar")
        .inOrder();
    assertThat(only("foo", "bar").union(only("bar", "dog")).limited().get())
        .containsExactly("foo", "bar", "dog")
        .inOrder();
  }

  @Test public void only_intersect() {
    assertThat(only("foo", "bar").intersect(only("dog", "bar", "foo")))
        .isEqualTo(only("foo", "bar"));
    assertThat(only("foo", "bar").intersect(only("bar", "dog", "foo")).limited().get())
        .containsExactly("foo", "bar")
        .inOrder();
    assertThat(only("foo").intersect(only("bar"))).isEqualTo(none());
  }

  @Test public void nonEmptyOrAll_empty() {
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SuppressWarnings("unchecked")
// static <T> Selection<T> all() {
//   return (Selection<T>) Selections.ALL;
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Selection<T> nonEmptyOrAll(Collection<? extends T> choices) {
//   return choices.isEmpty() ? all() : choices.stream().collect(toSelection());
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SuppressWarnings("unchecked")
// static <T> Selection<T> none() {
//   return (Selection<T>) Selections.NONE;
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// @SafeVarargs
// static <T> Selection<T> only(T... choices) {
//   return Arrays.stream(choices).collect(toSelection());
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<Selection<T>, ?, Selection<T>> toIntersection() {
//   return reducing(all(), Selection::intersect);
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<T, ?, Selection<T>> toSelection() {
//   return collectingAndThen(toImmutableSet(), Selections::explicit);
// }
// 
// Path: mug/src/main/java/com/google/mu/util/Selection.java
// static <T> Collector<Selection<T>, ?, Selection<T>> toUnion() {
//   return reducing(none(), Selection::union);
// }


// Path: mug/src/test/java/com/google/mu/util/SelectionTest.java
import org.junit.runners.JUnit4;
import com.google.common.collect.ImmutableSet;
import com.google.common.testing.EqualsTester;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.mu.util.Selection.all;
import static com.google.mu.util.Selection.nonEmptyOrAll;
import static com.google.mu.util.Selection.none;
import static com.google.mu.util.Selection.only;
import static com.google.mu.util.Selection.toIntersection;
import static com.google.mu.util.Selection.toSelection;
import static com.google.mu.util.Selection.toUnion;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.stream.Stream;
import org.junit.Test;
import org.junit.runner.RunWith;

  @Test public void only_has() {
    assertThat(only("foo").has("foo")).isTrue();
    assertThat(only("foo").has("bar")).isFalse();
    assertThat(only("foo").has(null)).isFalse();
  }

  @Test public void only_isEmpty() {
    assertThat(only("foo").isEmpty()).isFalse();
  }

  @Test public void only_union() {
    assertThat(only("foo").union(only("bar"))).isEqualTo(only("foo", "bar"));
    assertThat(only("foo").union(only("bar")).limited().get())
        .containsExactly("foo", "bar")
        .inOrder();
    assertThat(only("foo", "bar").union(only("bar", "dog")).limited().get())
        .containsExactly("foo", "bar", "dog")
        .inOrder();
  }

  @Test public void only_intersect() {
    assertThat(only("foo", "bar").intersect(only("dog", "bar", "foo")))
        .isEqualTo(only("foo", "bar"));
    assertThat(only("foo", "bar").intersect(only("bar", "dog", "foo")).limited().get())
        .containsExactly("foo", "bar")
        .inOrder();
    assertThat(only("foo").intersect(only("bar"))).isEqualTo(none());
  }

  @Test public void nonEmptyOrAll_empty() {
    assertThat(nonEmptyOrAll(asList()).limited()).isEmpty();