Page
7677787980818283
tester.startPage(SignOut.class); tester.assertRenderedPage(SignOut.class); tester.startPage(Home.class); tester.assertRenderedPage(SignIn2.class); } }
4647484950515253
tester.getApplication().getSecuritySettings().setAuthorizationStrategy( authorizationStrategy); tester.startPage(RedirectPage.class); tester.assertRenderedPage(LoginPage.class); } }
5152535455565758596061
{ // Default Config: parent first header render strategy log.error("=== PARENT first header render strategy ==="); WicketTester tester = new WicketTester(); tester.startPage(pageClass); tester.assertRenderedPage(pageClass); tester.assertResultPage(getClass(), filename); // child first header render strategy log.error("=== CHILD first header render strategy ==="); System.setProperty("Wicket_HeaderRenderStrategy",
61626364656667686970
System.setProperty("Wicket_HeaderRenderStrategy", ChildFirstHeaderRenderStrategy.class.getName()); // tester.getApplication().getApplicationSettings().setHeaderRenderStrategy( // new ChildFirstHeaderRenderStrategy()); tester.startPage(pageClass); tester.assertRenderedPage(pageClass); tester.assertResultPage(getClass(), filename + "_2"); System.setProperty("Wicket_HeaderRenderStrategy", ""); } }
165166167168169170171172173174175
tester.assertLabel("guessesRemaining", "4"); clickLetter(tester, 'a'); clickLetter(tester, 'n'); clickLetter(tester, 'g'); clickLetter(tester, 'm'); tester.assertRenderedPage(Win.class); } /** * Tests the webapplication for an unsuccessful match. */
189190191192193194195196197198199
clickLetter(tester, 't'); tester.assertLabel("guessesRemaining", "2"); clickLetter(tester, 'x'); tester.assertLabel("guessesRemaining", "1"); clickLetter(tester, 'z'); tester.assertRenderedPage(Lose.class); } /** * Performs a guess. *
5455565758596061626364
}); try { tester.startPage(LOGIN); tester.assertRenderedPage(LOGIN); FormTester form = tester.newFormTester("signInPanel:signInForm"); form.setValue("username", "test"); form.setValue("password", "test"); form.submit(); tester.assertRenderedPage(HOME);
5960616263646566676869
tester.assertRenderedPage(LOGIN); FormTester form = tester.newFormTester("signInPanel:signInForm"); form.setValue("username", "test"); form.setValue("password", "test"); form.submit(); tester.assertRenderedPage(HOME); } finally { tester.destroy(); }
6869707172737475767778
{ WicketTester tester = new WicketTester(); tester.getApplication().getSecuritySettings().setAuthorizationStrategy( new RoleAuthorizationStrategy(new UserRolesAuthorizer("ADMIN"))); tester.startPage(AdminPage.class); tester.assertRenderedPage(AdminPage.class); } /** * @throws Exception */
4243444546474849505152
doc = tester.getLastResponse().getDocument(); tester.assertContains("Template example, page 1 - page inheritance"); tester.assertContains("This is some concrete content from a panel."); tester.startPage(org.apache.wicket.examples.template.border.Page1.class); tester.assertRenderedPage(org.apache.wicket.examples.template.border.Page1.class); doc = tester.getLastResponse().getDocument(); tester.assertContains("Template example, page 1 - border"); tester.assertContains("contents here"); } }