Hi, I've been having problems migrating Wicket 1.4-RC4 to 1.4.1. Some of our
wicket-tests are failing and producing errors due to a form submission
issue.

For example:

.java:
public class Prueba extends PageTemplate {
    public Prueba() {
        add(new Form<Void>("form").add(new Button("submit", null) {
            @Override
            public void onSubmit() {
                System.out.println("submit listener");
            }
        }));
    }
}

.html:
<wicket:extend>
    <form wicket:id="form">
        <input type="submit" wicket:id="submit" />
    </form>
</wicket:extend>

test:
    @Test
    public void render(){
        tester.startPage(Prueba.class);
        tester.assertRenderedPage(Prueba.class);
        FormTester formTester = tester.newFormTester("form");
        formTester.submit("submit");
        tester.assertRenderedPage(Prueba.class); // This line produces
AssertionFailedError: expected:<Prueba> but was:<Home>

stacktrace:

 junit.framework.AssertionFailedError: expected:<Prueba> but was:<Home>
    at
org.apache.wicket.util.tester.WicketTester.assertResult(WicketTester.java:580)
    at
org.apache.wicket.util.tester.WicketTester.assertRenderedPage(WicketTester.java:528)
    at ar.edu.itba.it.dev.sga.PruebaTest.render(PruebaTest.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
    at
org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
    at
org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
    at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
    at
org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
    at
org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
    at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
    at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Debugging the formTester.submit I could see that when triying to resolve the
target because the page parameter path is empty the WebRequestCycleProcessor
decides to resolve to the home page (line 173). I have no problem when
submiting forms using AJAX components.

Thanks, Martin.

Reply via email to