// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/HtmlTestCase.java
// public abstract class HtmlTestCase extends JspTestCase {
// 
//     private Document renderedDocument;
//     private String renderedDocumentPath;
//     private Tidy tidy;
//     private DocumentBuilder documentBuilder;
// 
//     /**
//      * Simulate an HTTP request to a JSP, parsing the rendered output as HTML.
//      * 
//      * @param path
//      *            The path to the JSP to execute.
//      * @param httpMethod
//      *            "GET" or "POST".
//      */
//     protected void request(String path, String httpMethod) throws Exception {
//         super.request(path, httpMethod);
//         parseRenderedHtml();
//     }
// 
//     /**
//      * Returns the rendered HTML as an <tt>org.w3c.dom.Document</tt>.
//      */
//     protected Document getRenderedHtml() {
//         return renderedDocument;
//     }
// 
//     /**
//      * Returns the path to the rendered (and pretty-printed) HTML document.
//      */
//     protected String getRenderedHtmlPath() {
//         return renderedDocumentPath;
//     }
// 
//     private void parseRenderedHtml() {
//         try {
//             File original = File.createTempFile("renderedHtml", ".html");
//             IO.write(getRenderedResponse(), original);
//             File tidyHtml = new File(original.getAbsolutePath() + ".tidy.html");
//             parseRenderedOutput(original, tidyHtml);
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     private void parseRenderedOutput(File html, File prettyPrinted) {
//         try {
//             configureTidy().parse(new FileInputStream(html), new FileOutputStream(prettyPrinted));
//             DocumentBuilder db = configureDocumentBuilder();
//             renderedDocument = db.parse(prettyPrinted);
//             renderedDocumentPath = prettyPrinted.getAbsolutePath();
//         } catch (Throwable e) {
//             throw new RuntimeException(e.getMessage() + " (" + html.getAbsolutePath() + ")", e);
//         }
//     }
// 
//     private synchronized DocumentBuilder configureDocumentBuilder()
//             throws ParserConfigurationException {
//         if (documentBuilder == null) {
//             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//             documentBuilder = dbf.newDocumentBuilder();
//         }
//         return documentBuilder;
//     }
// 
//     private synchronized Tidy configureTidy() {
//         if (tidy == null) {
//             tidy = new Tidy();
//             tidy.setWraplen(Integer.MAX_VALUE);
//             tidy.setMakeClean(true);
//             tidy.setXmlOut(true);
//             tidy.setTidyMark(false);
//             tidy.setQuiet(true);
//             tidy.setShowWarnings(false);
//             tidy.setUpperCaseTags(true);
//             tidy.setUpperCaseAttrs(true);
//         }
//         return tidy;
//     }
// 
//     /**
//      * Returns a handle for making assertions about the specified HTML form.
//      */
//     public FormAssertion form(String name) {
//         return new FormAssertion(getRenderedHtml(), new NameChooser(name));
//     }
// 
//     /**
//      * Returns a handle for making assertions about an HTML form.
//      */
//     public FormAssertion form() {
//         return new FormAssertion(getRenderedHtml(), new ElementChooser() {
// 
//             public boolean accept(Element element) {
//                 return true;
//             }
//         });
//     }
// 
//     /**
//      * Returns a handle for making assertions about the rendered HTML page.
//      */
//     public PageAssertion page() {
//         return new PageAssertion(getRenderedHtml());
//     }
// 
//     /**
//      * Returns a handle for making assertions about the specified HTML element.
//      */
//     public ElementAssertion element(String xpathExpression) {
//         return new ElementAssertion(getRenderedHtml(), xpathExpression);
//     }
// }


import net.sf.jsptest.HtmlTestCase;
import junit.framework.AssertionFailedError;
package net.sf.jsptest.assertion;


/**
 * @author Lasse Koskela
 */
public abstract class ExpectedAssertionFailure {

    private HtmlTestCase testcase;

    /**
     * Override this method to perform a test that should fail with an exception.
     */
    protected abstract void run() throws Exception;

    /**
     * @param testcase
     *            The <tt>HtmlTestCase</tt> that serves as the context for this operation.
     */
// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/HtmlTestCase.java
// public abstract class HtmlTestCase extends JspTestCase {
// 
//     private Document renderedDocument;
//     private String renderedDocumentPath;
//     private Tidy tidy;
//     private DocumentBuilder documentBuilder;
// 
//     /**
//      * Simulate an HTTP request to a JSP, parsing the rendered output as HTML.
//      * 
//      * @param path
//      *            The path to the JSP to execute.
//      * @param httpMethod
//      *            "GET" or "POST".
//      */
//     protected void request(String path, String httpMethod) throws Exception {
//         super.request(path, httpMethod);
//         parseRenderedHtml();
//     }
// 
//     /**
//      * Returns the rendered HTML as an <tt>org.w3c.dom.Document</tt>.
//      */
//     protected Document getRenderedHtml() {
//         return renderedDocument;
//     }
// 
//     /**
//      * Returns the path to the rendered (and pretty-printed) HTML document.
//      */
//     protected String getRenderedHtmlPath() {
//         return renderedDocumentPath;
//     }
// 
//     private void parseRenderedHtml() {
//         try {
//             File original = File.createTempFile("renderedHtml", ".html");
//             IO.write(getRenderedResponse(), original);
//             File tidyHtml = new File(original.getAbsolutePath() + ".tidy.html");
//             parseRenderedOutput(original, tidyHtml);
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
//     private void parseRenderedOutput(File html, File prettyPrinted) {
//         try {
//             configureTidy().parse(new FileInputStream(html), new FileOutputStream(prettyPrinted));
//             DocumentBuilder db = configureDocumentBuilder();
//             renderedDocument = db.parse(prettyPrinted);
//             renderedDocumentPath = prettyPrinted.getAbsolutePath();
//         } catch (Throwable e) {
//             throw new RuntimeException(e.getMessage() + " (" + html.getAbsolutePath() + ")", e);
//         }
//     }
// 
//     private synchronized DocumentBuilder configureDocumentBuilder()
//             throws ParserConfigurationException {
//         if (documentBuilder == null) {
//             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//             documentBuilder = dbf.newDocumentBuilder();
//         }
//         return documentBuilder;
//     }
// 
//     private synchronized Tidy configureTidy() {
//         if (tidy == null) {
//             tidy = new Tidy();
//             tidy.setWraplen(Integer.MAX_VALUE);
//             tidy.setMakeClean(true);
//             tidy.setXmlOut(true);
//             tidy.setTidyMark(false);
//             tidy.setQuiet(true);
//             tidy.setShowWarnings(false);
//             tidy.setUpperCaseTags(true);
//             tidy.setUpperCaseAttrs(true);
//         }
//         return tidy;
//     }
// 
//     /**
//      * Returns a handle for making assertions about the specified HTML form.
//      */
//     public FormAssertion form(String name) {
//         return new FormAssertion(getRenderedHtml(), new NameChooser(name));
//     }
// 
//     /**
//      * Returns a handle for making assertions about an HTML form.
//      */
//     public FormAssertion form() {
//         return new FormAssertion(getRenderedHtml(), new ElementChooser() {
// 
//             public boolean accept(Element element) {
//                 return true;
//             }
//         });
//     }
// 
//     /**
//      * Returns a handle for making assertions about the rendered HTML page.
//      */
//     public PageAssertion page() {
//         return new PageAssertion(getRenderedHtml());
//     }
// 
//     /**
//      * Returns a handle for making assertions about the specified HTML element.
//      */
//     public ElementAssertion element(String xpathExpression) {
//         return new ElementAssertion(getRenderedHtml(), xpathExpression);
//     }
// }


// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/assertion/ExpectedAssertionFailure.java
import net.sf.jsptest.HtmlTestCase;
import junit.framework.AssertionFailedError;

package net.sf.jsptest.assertion;


/**
 * @author Lasse Koskela
 */
public abstract class ExpectedAssertionFailure {

    private HtmlTestCase testcase;

    /**
     * Override this method to perform a test that should fail with an exception.
     */
    protected abstract void run() throws Exception;

    /**
     * @param testcase
     *            The <tt>HtmlTestCase</tt> that serves as the context for this operation.
     */
    public ExpectedAssertionFailure(HtmlTestCase testcase) throws Exception {