// Path: src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java
// public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
//     return maxBy(projection, Comparable::compareTo);
// }
// 
// Path: src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java
// public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> minBy(Function<T, Y> projection) {
//     return minBy(projection, Comparable::compareTo);
// }


import org.junit.Test;
import java.util.Optional;
import java.util.stream.Stream;
import static com.codepoetics.protonpack.collectors.CollectorUtils.maxBy;
import static com.codepoetics.protonpack.collectors.CollectorUtils.minBy;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package com.codepoetics.protonpack;




public class MinMaxByProjectionTest {
    @Test
    public void
    max_by_with_projection_and_default_comparer() {
        Stream<String> integerStream = Stream.of("a", "bb", "ccc", "1");

        Optional<String> max = integerStream.collect(maxBy(String::length));

        assertThat(max.get(), is("ccc"));
    }

    @Test
    public void
// Path: src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java
// public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> maxBy(Function<T, Y> projection) {
//     return maxBy(projection, Comparable::compareTo);
// }
// 
// Path: src/main/java/com/codepoetics/protonpack/collectors/CollectorUtils.java
// public static <T, Y extends Comparable<Y>> Collector<T, ?, Optional<T>> minBy(Function<T, Y> projection) {
//     return minBy(projection, Comparable::compareTo);
// }


// Path: src/test/java/com/codepoetics/protonpack/MinMaxByProjectionTest.java
import org.junit.Test;
import java.util.Optional;
import java.util.stream.Stream;
import static com.codepoetics.protonpack.collectors.CollectorUtils.maxBy;
import static com.codepoetics.protonpack.collectors.CollectorUtils.minBy;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

package com.codepoetics.protonpack;




public class MinMaxByProjectionTest {
    @Test
    public void
    max_by_with_projection_and_default_comparer() {
        Stream<String> integerStream = Stream.of("a", "bb", "ccc", "1");

        Optional<String> max = integerStream.collect(maxBy(String::length));

        assertThat(max.get(), is("ccc"));
    }

    @Test
    public void
    min_by_with_projection_and_default_comparer() {