Bill Smith - 2002-12-06

I'm using httpunit 1.5.  How can I retrieve the options in an option menu?  I added the following method to FormParametersTest.  It fails on the last assertion:

    public void testFormRetrieval() throws Exception {
        try {
            System.out.println("enter testFormRetrieval");
            defineWebPage( "Default", "<form method=GET action = \"/ask\">" +
                           "<Select name=colors><Option>blue<Option>red</Select>" +
                           "<Select name=fish><Option value=red>snapper<Option value=pink>salmon</select>" +
                           "<Select name=media multiple size=2><Option>TV<Option>Radio</select>" +
                           "<Input type=submit></form>" );
            WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
            WebForm form = page.getForms()[0];
            assertEquals(form.getMethod(), "GET");
            assertEquals(form.getAction(), "/ask");
            String[] options = form.getOptions("colors");
            assertEquals(options.length, 2);
        }
        finally {
            System.out.println("leave testFormRetrieval");
        }
    }