EntryEditorWidgetSorter extends ViewerSorter implements SelectionListener { public int compare( Viewer viewer, Object o1, Object o2 ) { boolean objectClassAndMustAttributesFirst = preferences == null || preferences.isObjectClassAndMustAttributesFirst(); boolean operationalAttributesLast = preferences == null || preferences.isOperationalAttributesLast(); AttributeComparator comparator = new AttributeComparator( sortBy, getDefaultSortBy(), sortOrder, getDefaultSortOrder(), objectClassAndMustAttributesFirst, operationalAttributesLast ); return comparator.compare( o1, o2 ); } EntryEditorWidgetSorter( EntryEditorWidgetPreferences preferences ); void connect( TreeViewer viewer ); void dispose(); void widgetDefaultSelected( SelectionEvent e ); void widgetSelected( SelectionEvent event ); void sort( final Viewer viewer, Object[] elements ); int compare( Viewer viewer, Object o1, Object o2 );  }
@Test public void testEqual() { int result = sorter.compare( null, valueA1, valueA2 ); assertThat( result, equalTo( 0 ) ); }
@Test public void testLeftIsSmaller() { int result = sorter.compare( null, valueA1, valueB ); assertThat( result, equalTo( -1 ) ); }
@Test public void testRightIsSmaller() { int result = sorter.compare( null, valueB, valueA2 ); assertThat( result, equalTo( 1 ) ); }
@Test public void testLeftIsEmpty() { int result = sorter.compare( null, empytValue1, valueA2 ); assertThat( result, equalTo( -1 ) ); }
@Test public void testRightIsEmpty() { int result = sorter.compare( null, valueB, empytValue2 ); assertThat( result, equalTo( 1 ) ); }
@Test public void testBothAreEmpty() { int result = sorter.compare( null, empytValue1, empytValue2 ); assertThat( result, equalTo( 0 ) ); }