/** * Dumps the source of last rendered <code>Page</code>. */ public void dumpPage() { log.info(getServletResponse().getDocument()); }
/** * Dumps the source of last rendered <code>Page</code>. */ public void dumpPage() { log.info(getServletResponse().getDocument()); }
/** * 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 = getServletResponse().getDocument(); Assert.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 = getServletResponse().getDocument(); Assert.assertEquals(expectedDocument, document); }
/** * assert the content of last rendered page contains(matches) regex pattern. * * @param pattern * reqex pattern to match * @return a <code>Result</code> */ public Result ifContains(String pattern) { return isTrue("pattern '" + pattern + "' not found", getServletResponse().getDocument() .matches("(?s).*" + pattern + ".*")); }
/** * assert the content of last rendered page contains(matches) regex pattern. * * @param pattern * reqex pattern to match * @return a <code>Result</code> */ public Result ifContains(String pattern) { return isTrue("pattern '" + pattern + "' not found", getServletResponse().getDocument() .matches("(?s).*" + pattern + ".*")); }
/** * assert the content of last rendered page contains(matches) regex pattern. * * @param pattern * reqex pattern to match * @return a <code>Result</code> */ public Result ifContainsNot(String pattern) { return isFalse("pattern '" + pattern + "' found", getServletResponse().getDocument() .matches("(?s).*" + pattern + ".*")); }
/** * Asserts last rendered <code>Page</code> against an expected HTML document as a * <code>String</code>. * * @param expectedDocument * expected output * @return a <code>Result</code> * @throws Exception */ public Result isResultPage(final String expectedDocument) throws Exception { // Validate the document String document = getServletResponse().getDocument(); return isTrue("expected rendered page equals", document.equals(expectedDocument)); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s exist * with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "id", id); }
/** * Asserts last rendered <code>Page</code> against an expected HTML document as a * <code>String</code>. * * @param expectedDocument * expected output * @return a <code>Result</code> * @throws Exception */ public Result isResultPage(final String expectedDocument) throws Exception { // Validate the document String document = getServletResponse().getDocument(); return isTrue("expected rendered page equals", document.equals(expectedDocument)); }
/** * Modified version of BaseWicketTester#getTagByWicketId(String) that returns all matching tags * instead of just the first. * * @see BaseWicketTester#getTagByWicketId(String) */ public static List<TagTester> getTagsByWicketId(WicketTester tester, String wicketId) { return TagTester.createTagsByAttribute(tester.getServletResponse().getDocument(), "wicket:id", wicketId, false); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s * exist with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "id", id); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only the * first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "wicket:id", wicketId); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only * the first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "wicket:id", wicketId); }
/** * 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. * </p> * * @param pageClass * used to load the <code>File</code> (relative to <code>clazz</code> package) * @param filename * expected output <code>File</code> name * @throws Exception */ public void assertResultPage(final Class pageClass, final String filename) throws Exception { // Validate the document String document = getServletResponse().getDocument(); DiffUtil.validatePage(document, pageClass, 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 = getServletResponse().getDocument(); 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. * </p> * * @param pageClass * used to load the <code>File</code> (relative to <code>clazz</code> package) * @param filename * expected output <code>File</code> name * @throws Exception */ public void assertResultPage(final Class<?> pageClass, final String filename) throws Exception { // Validate the document String document = getServletResponse().getDocument(); DiffUtil.validatePage(document, pageClass, 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 */ public void assertResultPage(final Class clazz, final String filename) throws Exception { String document = getServletResponse().getDocument(); setupRequestAndResponse(); DiffUtil.validatePage(document, clazz, filename, true); }
out.write(tester.getServletResponse().getDocument().getBytes(getHtmlEncoding())); out.flush();
out.write(tester.getServletResponse().getDocument().getBytes(getHtmlEncoding())); out.flush();