// 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;
        () -> Selection.delimitedBy(Substring.first('*').or(Substring.last('/'))));
  }

  @Test public void testEquals() throws Exception {
    new EqualsTester()
        .addEqualityGroup(
            all(),
            all().union(all()),
            all().union(none()),
            none().union(all()),
            all().union(only("foo")),
            only("foo").union(all()),
            all().intersect(all()),
            nonEmptyOrAll(asList()))
        .addEqualityGroup(
            none(),
            only(),
            none().intersect(none()),
            none().intersect(all()),
            all().intersect(none()),
            none().intersect(only("foo")),
            only("foo").intersect(none()))
        .addEqualityGroup(
            only("foo"),
            only("foo", "foo"),
            all().intersect(only("foo")),
            none().union(only("foo")),
            only("foo").intersect(all()),
            only("foo").union(none()),
            only("foo", "bar").intersect(only("baz", "foo")),
// 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;

        () -> Selection.delimitedBy(Substring.first('*').or(Substring.last('/'))));
  }

  @Test public void testEquals() throws Exception {
    new EqualsTester()
        .addEqualityGroup(
            all(),
            all().union(all()),
            all().union(none()),
            none().union(all()),
            all().union(only("foo")),
            only("foo").union(all()),
            all().intersect(all()),
            nonEmptyOrAll(asList()))
        .addEqualityGroup(
            none(),
            only(),
            none().intersect(none()),
            none().intersect(all()),
            all().intersect(none()),
            none().intersect(only("foo")),
            only("foo").intersect(none()))
        .addEqualityGroup(
            only("foo"),
            only("foo", "foo"),
            all().intersect(only("foo")),
            none().union(only("foo")),
            only("foo").intersect(all()),
            only("foo").union(none()),
            only("foo", "bar").intersect(only("baz", "foo")),
            Stream.of("foo", "foo").collect(toSelection()),