Hi Guys I am new to WicketTester and testing pages here. I am also getting back into wicket slowly.
I have a page which currently simply adds a panel (more to come), the panel contains a DataTable. I am not interested in the content of the table just that the page renders with an empty table. MyPage -> MyPanel -> Adds a DataTable, using dataproviders. The problem is that when I do tester.startPage(MyPage.class) it tries to add the data table and fails unless data provider size is set to 0. MyPage Code public class MyPage extends BasePage<AdminViewPage> { private NotificationPanel notificationPanel; private BootstrapDefaultDataTable<UserAccount, String> userTable; public MyPage() { notificationPanel = new NotificationPanel("notification"); notificationPanel.setOutputMarkupId(true); notificationPanel.hideAfter(Duration.seconds(2)); add(notificationPanel); add(new MyPanel("users-table-panel")); } } MyPanel code public class MyPanel extends Panel { private NotificationPanel notificationPanel; private BootstrapDefaultDataTable<UserAccount, String> userTable; public UsersTablePanel(String id) { super(id); notificationPanel = new NotificationPanel("notification"); notificationPanel.setOutputMarkupId(true); notificationPanel.hideAfter(Duration.seconds(2)); add(notificationPanel); usersTable(); } private void usersTable() { List<IColumn<UserAccount, String>> columns = new ArrayList<>(); columns.add(new PropertyColumn<>(Model.of("First Name"), "firstName", "firstName")); columns.add(new PropertyColumn<>(Model.of("Last Name"), "lastName")); columns.add(new PropertyColumn<>(Model.of("Email Address"), "email")); columns.add(new PropertyColumn<>(Model.of("Username"), "userName")); userTable = new BootstrapDefaultDataTable<>("users-table", columns, new DataProvider(), 20); userTable.add(new TableBehavior().hover().bordered()); add(userTable); } } MyPageTest Code public class AdminViewPageTest extends WicketApplicationTest { private WicketTester tester; private UsersDataProvider usersDataProvider; private AdminViewPage adminViewPage; @Before public void setUp() throws Exception { super.setUp(); usersDataProvider = mock(UsersDataProvider.class); adminViewPage = new AdminViewPage(); doNothing().when(usersDataProvider).checkDAO(); when(usersDataProvider.size()).thenReturn(0L); tester = getTester(); tester.startPage(adminViewPage); } @Test public void renderSuccessfully() throws Exception { tester.assertRenderedPage(AdminViewPage.class); } } Any pointers would be great. Thanks David