### Question:
DefaultSortController extends DefaultRowSorter<M, Integer> implements
        SortController<M> { @Override public int convertRowIndexToView(int modelIndex) { if ((modelIndex < 0) || modelIndex >= getModelRowCount()) throw new IndexOutOfBoundsException("valid modelIndex: 0 <= index < " + getModelRowCount() + " but was: " + modelIndex); try { return super.convertRowIndexToView(modelIndex); } catch (Exception e) { } return modelIndex; } DefaultSortController(); @Override void setSortable(boolean sortable); @Override boolean isSortable(); @Override void setSortable(int column, boolean sortable); @Override boolean isSortable(int column); @Override void toggleSortOrder(int column); @Override void setSortOrder(int column, SortOrder sortOrder); @Override SortOrder getSortOrder(int column); @Override void resetSortOrders(); @Override SortOrder[] getSortOrderCycle(); @Override void setSortOrderCycle(SortOrder... cycle); @Override void setStringValueProvider(StringValueProvider registry); @Override StringValueProvider getStringValueProvider(); static SortOrder[] getDefaultSortOrderCycle(); @Override int convertRowIndexToModel(int viewIndex); @Override int convertRowIndexToView(int modelIndex); @Override int getModelRowCount(); @Override int getViewRowCount(); @Override void allRowsChanged(); @Override void modelStructureChanged(); @Override void rowsDeleted(int firstRow, int endRow); @Override void rowsInserted(int firstRow, int endRow); @SuppressWarnings({ "unchecked", "rawtypes" })
    static final Comparator COMPARABLE_COMPARATOR; }### Answer:
@Test public void testToViewAfterSilentRemoveNotSorted() { model.removeRow(rows - 1); assertEquals(rows - 1, sorter.convertRowIndexToView(rows - 1)); }
@Test public void testToViewAfterSilentRemoveAllPassFilter() { RowFilter<Object, Object> filter = RowFilter.regexFilter(".*"); sorter.setRowFilter(filter); model.removeRow(rows - 1); assertEquals(rows - 1, sorter.convertRowIndexToView(rows - 1)); }
@Test (expected = IndexOutOfBoundsException.class) public void testToViewAfterSilentInsertAllPassFilter() { RowFilter<Object, Object> filter = RowFilter.regexFilter(".*"); sorter.setRowFilter(filter); model.addRow(new Object[] {rows}); assertEquals(rows, sorter.convertRowIndexToView(rows)); }
@Test (expected = IndexOutOfBoundsException.class) public void testToViewAfterSilentInsertNotSorted() { model.addRow(new Object[] {rows}); sorter.convertRowIndexToView(rows); }