I upgrade to latest CVS, but found behavior of FormTester changed.
below is small test case for wicket.util.tester.WicketTesterTest:

public void testCreateBook_submit() throws Exception
{
    MyMockApplication tester = new MyMockApplication();
    tester.startPage(CreateBook.class);

    FormTester formTester = tester.newFormTester("createForm");

    // two fields are required, one is "name", the other is "id"
    // and we only fill one:
    formTester.setValue("name", "xxName");
    formTester.submit();

    // we got validation error message:
    tester.assertErrorMessages (new String[] { "id is required" });

    // now we continue test the same page, the "name" Field should
    // contains value "xxName" on the page

    FormTester formTesterContinue = tester.newFormTester("createForm");

    // fill "id" with value "xxId", so all validations should be passed
    formTesterContinue.setValue("id", "xxId");
    formTesterContinue.submit();

    // but test failed ! I got "name is required" message because
    // there is no "name" in request parameter.
    tester.assertNoErrorMessage();
}

FormTester can not convert exist values of fields into request parameters.
Are there changes on MockHttpServletRequest or something recently ?

--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen

Reply via email to