@Test
 public void testMinIndex() {
   List<Integer> ints = IntStreamEx.of(new Random(1), 1000, 5, 47).boxed().toList();
   long expectedMin = IntStreamEx.ofIndices(ints).minBy(ints::get).getAsInt();
   long expectedMax = IntStreamEx.ofIndices(ints).maxBy(ints::get).getAsInt();
   long expectedMinString =
       IntStreamEx.ofIndices(ints).minBy(i -> String.valueOf(ints.get(i))).getAsInt();
   long expectedMaxString =
       IntStreamEx.ofIndices(ints).maxBy(i -> String.valueOf(ints.get(i))).getAsInt();
   Comparator<Integer> cmp = Comparator.comparing(String::valueOf);
   checkCollector(
       "minIndex", OptionalLong.of(expectedMin), ints::stream, MoreCollectors.minIndex());
   checkCollector(
       "maxIndex", OptionalLong.of(expectedMax), ints::stream, MoreCollectors.maxIndex());
   checkCollector(
       "minIndex", OptionalLong.of(expectedMinString), ints::stream, MoreCollectors.minIndex(cmp));
   checkCollector(
       "maxIndex", OptionalLong.of(expectedMaxString), ints::stream, MoreCollectors.maxIndex(cmp));
   Supplier<Stream<String>> supplier = () -> ints.stream().map(Object::toString);
   checkCollector(
       "minIndex", OptionalLong.of(expectedMinString), supplier, MoreCollectors.minIndex());
   checkCollector(
       "maxIndex", OptionalLong.of(expectedMaxString), supplier, MoreCollectors.maxIndex());
   checkCollectorEmpty("minIndex", OptionalLong.empty(), MoreCollectors.<String>minIndex());
   checkCollectorEmpty("maxIndex", OptionalLong.empty(), MoreCollectors.<String>maxIndex());
 }