package org.osgl;

import org.junit.Test;

public class ComparatorTest extends TestBase {

    @Test
    public void testReversedOrder() {
    }
}

@@ -39,104 +39,1832 @@
 st;%0A
-%0Apublic class ComparatorTest extends TestBase %7B%0A%0A    @Test%0A    public void testReversedOrder() %7B
+import org.osgl.exception.NotAppliedException;%0Aimport org.osgl.util.E;%0A%0Aimport java.util.Comparator;%0A%0Apublic class ComparatorTest extends TestBase %7B%0A%0A    protected static class Foo extends _.T2%3CInteger, String%3E %7B%0A        public Foo(int _1, String _2) %7B%0A            super(_1, _2);%0A            E.NPE(_2);%0A        %7D%0A    %7D%0A%0A    protected Foo a = new Foo(1, %22abc%22);%0A    protected Foo b = new Foo(1, %22xyz%22);%0A%0A    protected _.Comparator%3CInteger%3E c = new _.Comparator%3CInteger%3E() %7B%0A        @Override%0A        public int compare(Integer o1, Integer o2) %7B%0A            return o1 - o2;%0A        %7D%0A    %7D;%0A%0A    protected _.Comparator%3CFoo%3E cmp = new _.Comparator%3CFoo%3E() %7B%0A        @Override%0A        public int compare(Foo o1, Foo o2) %7B%0A            return o1._1 - o2._1;%0A        %7D%0A    %7D;%0A%0A    protected _.F1%3CFoo, String%3E keyExtractor = new _.F1%3CFoo, String%3E() %7B%0A        @Override%0A        public String apply(Foo foo) throws NotAppliedException, _.Break %7B%0A            return foo._2;%0A        %7D%0A    %7D;%0A%0A    @Test%0A    public void testReversedOrder() %7B%0A        int a = 0, b = 1;%0A        eq(c.apply(a, b), c.reversed().apply(b, a));%0A    %7D%0A%0A    @Test%0A    public void testThenComparing() %7B%0A        yes(cmp.thenComparing(new _.Comparator%3CFoo%3E() %7B%0A            @Override%0A            public int compare(Foo o1, Foo o2) %7B%0A                return o1._2.compareTo(o2._2);%0A            %7D%0A        %7D).apply(a, b) %3C 0);%0A    %7D%0A%0A    @Test%0A    public void testThenComparing2() %7B%0A        Comparator%3CString%3E kcmp = new Comparator%3CString%3E() %7B%0A            @Override%0A            public int compare(String o1, String o2) %7B%0A                return o1.compareTo(o2);%0A            %7D%0A        %7D;%0A        yes(cmp.thenComparing(keyExtractor, kcmp).apply(a, b) %3C 0);%0A    %7D%0A%0A    @Test%0A    public void testThenComparing3() %7B%0A        yes(cmp.thenComparing(keyExtractor).apply(a, b) %3C 0);
 %0A   

add test case