/** * Asserts last-rendered <code>Page</code> against an expected HTML document as a * <code>String</code> * * @param expectedDocument * expected output <code>String</code> */ public void assertResultPage(final String expectedDocument) { // Validate the document String document = getLastResponseAsString(); assertEquals(expectedDocument, document); }
/** * Asserts last-rendered <code>Page</code> against an expected HTML document as a * <code>String</code> * * @param expectedDocument * expected output <code>String</code> * @throws Exception */ public void assertResultPage(final String expectedDocument) throws Exception { // Validate the document String document = getLastResponseAsString(); assertEquals(expectedDocument, document); }
/** * Asserts last-rendered <code>Page</code> against an expected HTML document. * <p> * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected * output file. * * @param clazz * <code>Class</code> used to load the file (relative to <code>clazz</code> package) * @param filename * expected output filename <code>String</code> * @throws Exception */ @Override public void assertResultPage(final Class<?> clazz, final String filename) throws Exception { String document = getLastResponseAsString(); DiffUtil.validatePage(document, clazz, filename, true); }
/** * Asserts last-rendered <code>Page</code> against an expected HTML document. * <p> * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected * output file. * * @param clazz * <code>Class</code> used to load the file (relative to <code>clazz</code> package) * @param filename * expected output filename <code>String</code> * @throws Exception */ @Override public void assertResultPage(final Class<?> clazz, final String filename) throws Exception { String document = getLastResponseAsString(); DiffUtil.validatePage(document, clazz, filename, true); }
WicketTester tester = new WicketTester(new MyApplication(); tester.startPage(MyPage.class); String MyPageAsString = tester.getLastResponseAsString();
@Test public void testLoginButton() { tester.startPage(GeoServerHomePage.class); String html = tester.getLastResponseAsString(); LOGGER.log(Level.INFO, "Last HTML page output:\n" + html); // the login form is there and has the link assertTrue( html.contains( "<form style=\"display: inline-block;\" method=\"post\" action=\"../web/j_spring_oauth2_github_login\">")); assertTrue( html.contains( "<img src=\"./wicket/resource/org.geoserver.web.security.oauth2.GitHubOAuth2AuthProviderPanel/github")); } }
@Test public void testLoginButton() { tester.startPage(GeoServerHomePage.class); String html = tester.getLastResponseAsString(); LOGGER.log(Level.INFO, "Last HTML page output:\n" + html); // the login form is there and has the link assertTrue( html.contains( "<form style=\"display: inline-block;\" method=\"post\" action=\"../web/j_spring_oauth2_google_login\">")); assertTrue( html.contains( "<img src=\"./wicket/resource/org.geoserver.web.security.oauth2.GoogleOAuth2AuthProviderPanel/google")); } }
@Test public void testLoginButton() { tester.startPage(GeoServerHomePage.class); String html = tester.getLastResponseAsString(); LOGGER.log(Level.INFO, "Last HTML page output:\n" + html); // the login form is there and has the link assertTrue( html.contains( "<form style=\"display: inline-block;\" method=\"post\" action=\"../web/j_spring_oauth2_openid_connect_login\">")); assertTrue( html.contains( "<img src=\"./wicket/resource/org.geoserver.web.security.oauth2.OpenIdConnectAuthProviderPanel/openid")); } }
@Test public void lessFileWasGeneratedWithCorrectContent() { BootstrapCssReference ref = BootstrapCssReference.INSTANCE; tester().startResourceReference(ref); Assert.assertThat(tester().getLastResponseAsString(), is(equalTo(cssContent))); } }
@Test @Ignore // update bootstrap css file public void lessFileWasGeneratedWithCorrectContent() { BootstrapCssReference ref = BootswatchCssReference.CERULEAN; tester().startResourceReference(ref); Assert.assertThat(cssContent, is(equalTo(tester().getLastResponseAsString()))); }
String html = tester.getLastResponseAsString(); TagTester menuTester = TagTester.createTagByAttribute(