コード例 #1
0
  public void testPaginationSecondPage() {
    table.setPaginated(true);
    table.setCurrPageNumber(2);

    table.computeDisplay();

    ArrayList rows = table.getRows();
    assertEquals("got right number of rows", rows.size(), 8);
  }
コード例 #2
0
  public void testPaginationFirstPage() {
    table.setPaginated(true);
    table.setCurrPageNumber(1);

    table.computeDisplay();

    ArrayList rows = table.getRows();
    assertEquals("got right number of rows", rows.size(), EntityBeanTable.NUM_ROWS_PER_PAGE);
  }
コード例 #3
0
  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");
  }
コード例 #4
0
  public void testPaginationSecondPageWithSortDESC() {
    // we're going to sort by username DESC, then paginate and go to page 2
    // since user efg is in the middle by username,
    // the first element of rows should be that user

    table.setSortingColumnInd(UserAccountRow.COL_USERNAME);
    table.setAscendingSort(false);
    table.setPaginated(true);
    table.setCurrPageNumber(2);

    table.computeDisplay();

    ArrayList rows = table.getRows();
    assertEquals("got right number of rows", rows.size(), 8);

    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(), "abc");
  }