// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/html/Form.java
// public class Form {
// 
//     private Element element;
//     private NodeList fields;
// 
//     /**
//      * Build a <tt>Form</tt> from an HTML element.
//      * 
//      * @param element
//      *            The HTML form element to represent.
//      */
//     public Form(Element element) {
//         this.element = element;
//         fields = element.getElementsByTagName("INPUT");
//     }
// 
//     /**
//      * Returns the name of the HTML form.
//      */
//     public String getName() {
//         return element.getAttribute("NAME");
//     }
// 
//     /**
//      * Indicates whether the form has an input field by the given name.
//      * 
//      * @param name
//      *            The name of the input field.
//      */
//     public boolean hasInputField(String name) {
//         if (getInputField(name) != null) {
//             return true;
//         }
//         return false;
//     }
// 
//     /**
//      * Returns the specified input field or <tt>null</tt> if no such field exists on the form.
//      * 
//      * @param name
//      *            The name of the input field.
//      */
//     public FormField getInputField(String name) {
//         for (int i = 0; i < fields.getLength(); i++) {
//             FormField field = new FormField((Element) fields.item(i));
//             if (name.equals(field.getName())) {
//                 return field;
//             }
//         }
//         return null;
//     }
// 
//     /**
//      * Indicates whether the form has a submit button by the given name.
//      * 
//      * @param name
//      *            The name of the submit button.
//      */
//     public boolean hasSubmitButton(String name) {
//         NodeList elems = element.getElementsByTagName("INPUT");
//         for (int i = 0; i < elems.getLength(); i++) {
//             Element element = (Element) elems.item(i);
//             if ("SUBMIT".equalsIgnoreCase(element.getAttribute("TYPE"))) {
//                 if (name.equals(element.getAttribute("VALUE"))) {
//                     return true;
//                 }
//                 if (name.equals(element.getAttribute("NAME"))) {
//                     return true;
//                 }
//             }
//         }
//         return false;
//     }
// 
//     /**
//      * Indicates whether the form has a submit button.
//      */
//     public boolean hasSubmitButton() {
//         NodeList elems = element.getElementsByTagName("INPUT");
//         for (int i = 0; i < elems.getLength(); i++) {
//             Element element = (Element) elems.item(i);
//             if ("SUBMIT".equalsIgnoreCase(element.getAttribute("TYPE"))) {
//                 return true;
//             }
//         }
//         return false;
//     }
// }
// 
// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/html/FormField.java
// public class FormField {
// 
//     private Element element;
// 
//     /**
//      * Build an input field from the given HTML element.
//      * 
//      * @param element
//      *            The HTML input element.
//      */
//     public FormField(Element element) {
//         this.element = element;
//     }
// 
//     /**
//      * Returns the name of the field.
//      */
//     public String getName() {
//         return element.getAttribute("NAME");
//     }
// 
//     /**
//      * Returns the value of the field.
//      */
//     public String getValue() {
//         return element.getAttribute("VALUE");
//     }
// }


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import junit.framework.Assert;
import net.sf.jsptest.html.Form;
import net.sf.jsptest.html.FormField;
package net.sf.jsptest.assertion;


/**
 * Provides form field-oriented assertion methods.
 * 
 * @author Lasse Koskela
 */
public class FormFieldAssertion {

    private final List fields;
    private final String fieldName;

    /**
     * @param forms
     *            The list of forms that should be considered the context for the subsequent
     *            assertion methods.
     * @param fieldName
     *            The name of the form field that should be considered the context for the
     *            subsequent assertion methods.
     */
    public FormFieldAssertion(List forms, String fieldName) {
        this.fieldName = fieldName;
        this.fields = new ArrayList();
        for (Iterator i = forms.iterator(); i.hasNext();) {
// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/html/Form.java
// public class Form {
// 
//     private Element element;
//     private NodeList fields;
// 
//     /**
//      * Build a <tt>Form</tt> from an HTML element.
//      * 
//      * @param element
//      *            The HTML form element to represent.
//      */
//     public Form(Element element) {
//         this.element = element;
//         fields = element.getElementsByTagName("INPUT");
//     }
// 
//     /**
//      * Returns the name of the HTML form.
//      */
//     public String getName() {
//         return element.getAttribute("NAME");
//     }
// 
//     /**
//      * Indicates whether the form has an input field by the given name.
//      * 
//      * @param name
//      *            The name of the input field.
//      */
//     public boolean hasInputField(String name) {
//         if (getInputField(name) != null) {
//             return true;
//         }
//         return false;
//     }
// 
//     /**
//      * Returns the specified input field or <tt>null</tt> if no such field exists on the form.
//      * 
//      * @param name
//      *            The name of the input field.
//      */
//     public FormField getInputField(String name) {
//         for (int i = 0; i < fields.getLength(); i++) {
//             FormField field = new FormField((Element) fields.item(i));
//             if (name.equals(field.getName())) {
//                 return field;
//             }
//         }
//         return null;
//     }
// 
//     /**
//      * Indicates whether the form has a submit button by the given name.
//      * 
//      * @param name
//      *            The name of the submit button.
//      */
//     public boolean hasSubmitButton(String name) {
//         NodeList elems = element.getElementsByTagName("INPUT");
//         for (int i = 0; i < elems.getLength(); i++) {
//             Element element = (Element) elems.item(i);
//             if ("SUBMIT".equalsIgnoreCase(element.getAttribute("TYPE"))) {
//                 if (name.equals(element.getAttribute("VALUE"))) {
//                     return true;
//                 }
//                 if (name.equals(element.getAttribute("NAME"))) {
//                     return true;
//                 }
//             }
//         }
//         return false;
//     }
// 
//     /**
//      * Indicates whether the form has a submit button.
//      */
//     public boolean hasSubmitButton() {
//         NodeList elems = element.getElementsByTagName("INPUT");
//         for (int i = 0; i < elems.getLength(); i++) {
//             Element element = (Element) elems.item(i);
//             if ("SUBMIT".equalsIgnoreCase(element.getAttribute("TYPE"))) {
//                 return true;
//             }
//         }
//         return false;
//     }
// }
// 
// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/html/FormField.java
// public class FormField {
// 
//     private Element element;
// 
//     /**
//      * Build an input field from the given HTML element.
//      * 
//      * @param element
//      *            The HTML input element.
//      */
//     public FormField(Element element) {
//         this.element = element;
//     }
// 
//     /**
//      * Returns the name of the field.
//      */
//     public String getName() {
//         return element.getAttribute("NAME");
//     }
// 
//     /**
//      * Returns the value of the field.
//      */
//     public String getValue() {
//         return element.getAttribute("VALUE");
//     }
// }


// Path: jsptest-generic/jsptest-framework/src/main/java/net/sf/jsptest/assertion/FormFieldAssertion.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import junit.framework.Assert;
import net.sf.jsptest.html.Form;
import net.sf.jsptest.html.FormField;

package net.sf.jsptest.assertion;


/**
 * Provides form field-oriented assertion methods.
 * 
 * @author Lasse Koskela
 */
public class FormFieldAssertion {

    private final List fields;
    private final String fieldName;

    /**
     * @param forms
     *            The list of forms that should be considered the context for the subsequent
     *            assertion methods.
     * @param fieldName
     *            The name of the form field that should be considered the context for the
     *            subsequent assertion methods.
     */
    public FormFieldAssertion(List forms, String fieldName) {
        this.fieldName = fieldName;
        this.fields = new ArrayList();
        for (Iterator i = forms.iterator(); i.hasNext();) {
            Form form = (Form) i.next();