public void testShouldInvert() throws Exception { InvertibleComparator<Integer> invertibleComparator = new InvertibleComparator<Integer>(comparator); assertThat(invertibleComparator.isAscending(), is(true)); assertThat(invertibleComparator.compare(1, 2), is(-1)); invertibleComparator.invertOrder(); assertThat(invertibleComparator.isAscending(), is(false)); assertThat(invertibleComparator.compare(1, 2), is(1)); }
public void testShouldDefaultToAscending() throws Exception { InvertibleComparator<Integer> invertibleComparator = new InvertibleComparator<Integer>(comparator); assertThat(invertibleComparator.isAscending(), is(true)); assertThat(invertibleComparator.compare(1, 2), is(-1)); }