Example usage for org.apache.wicket.markup.html.navigation.paging IPageableItems getItemCount

List of usage examples for org.apache.wicket.markup.html.navigation.paging IPageableItems getItemCount

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.navigation.paging IPageableItems getItemCount.

Prototype

long getItemCount();

Source Link

Document

Gets the total number of items this object has.

Usage

From source file:my.blank.project.web.page.EmpListTest.java

License:Apache License

@Test
public void testRenderEmpListPage() {
    List<Emp> empList = new ArrayList<>();
    Emp emp = new Emp();
    emp.setId(110L);//w  ww .java2  s  .  c o  m
    emp.setEmpNo(97768);
    emp.setEmpName("Test Engineer");
    empList.add(emp);

    expect(empService.selectAll()).andReturn(empList).anyTimes();

    replay(empService);

    // start and render the test page
    tester.startPage(EmpList.class);

    // assert rendered page class
    tester.assertRenderedPage(EmpList.class);

    // assert rendered components
    tester.assertContains("EmpList");
    tester.assertContains("EmpId");
    tester.assertContains("EmpNo");
    tester.assertContains("EmpName");

    tester.assertComponent("empList", PageableListView.class);
    IPageableItems renderedEmpList = (IPageableItems) tester.getComponentFromLastRenderedPage("empList");
    assertThat(renderedEmpList.getItemCount(), is(1L));
    tester.assertContains("110");
    tester.assertContains("97768");
    tester.assertContains("Test Engineer");

    tester.assertComponent("navigator", PagingNavigator.class);

    verify(empService);
}