public void testSearchWithNoResults() { table.setFiltered(true); table.setKeywordFilter("zzz"); table.computeDisplay(); ArrayList rows = table.getRows(); assertEquals("got right number of rows", rows.size(), 0); }
public void testSearchMultipleKeywords() { // we will use the multi-keyword search feature, searching for "def" and "ghi" // this should return only users def and ghi, no one else // so we expect exactly two rows table.setFiltered(true); table.setKeywordFilter("def ghi"); table.computeDisplay(); ArrayList rows = table.getRows(); assertEquals("got right number of rows", rows.size(), 2); }
public void testPaginationWithSearchSecondPage() { table.setFiltered(true); table.setPaginated(true); table.setKeywordFilter("efg"); table.setCurrPageNumber(2); table.computeDisplay(); ArrayList rows = table.getRows(); assertEquals("got right number of rows", rows.size(), 5); UserAccountRow head = (UserAccountRow) rows.get(0); UserAccountRow tail = (UserAccountRow) rows.get(rows.size() - 1); assertEquals("correct bean at top of the list", head.getBean().getName(), "efg"); assertEquals("correct bean at end of the list", tail.getBean().getName(), "efg"); }
public void testSearchAndSortingCombined() { table.setFiltered(true); table.setKeywordFilter("abc"); table.setAscendingSort(true); table.setSortingColumnInd(UserAccountRow.COL_FIRSTNAME); table.computeDisplay(); // users abc and def should have been returned. // since we are sorting on the first name, def should show up first ArrayList rows = table.getRows(); assertEquals("got right number of rows", rows.size(), 2); UserAccountRow row = (UserAccountRow) rows.get(0); assertEquals("got first row right", row.getBean().getName(), "def"); }