Hi all, I'm getting some strange behavior from my tests. I have an abstract class that all ajax feedback forms inherit from. BaseFeedBackForm
http://pastebin.com/NWALFWvi I have this test code http://pastebin.com/zZyzG1e6 What's happening is my onBeforeRender of my BaseFeedbackForm is being invoked twice. The first time it is invoked is by this line of code in my test. tester.startPage(HomePage.class); This visits all the form components, and decorates all components except buttons with a FormFeedBacklabel. A label I'm using to display validation errors when the input is incorrect onblur. This works well when the form is created both in my unit test and when rendered via a browser. However, when this is invoked. registerForm.submit(); My page is re-rendered, which is throwing the error org.apache.wicket.WicketRuntimeException: Error attaching this container for rendering: [MarkupContainer [Component id = registrationPanel]] at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1739) at org.apache.wicket.Component.onBeforeRender(Component.java:3855) at org.apache.wicket.Component.internalBeforeRender(Component.java:1061) at org.apache.wicket.Component.beforeRender(Component.java:1095) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1727) at org.apache.wicket.Component.onBeforeRender(Component.java:3855) at org.apache.wicket.Page.onBeforeRender(Page.java:1521) at org.apache.wicket.Component.internalBeforeRender(Component.java:1061) at org.apache.wicket.Component.beforeRender(Component.java:1095) at org.apache.wicket.Component.prepareForRender(Component.java:2225) at org.apache.wicket.Component.prepareForRender(Component.java:2262) at org.apache.wicket.Page.renderPage(Page.java:893) at org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:63) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:524) at org.apache.wicket.util.tester.FormTester.submit(FormTester.java:667) at com.spidertracks.aviator.logbook.HomePageTest.testSignupValid(HomePageTest.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod $1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 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) Caused by: java.lang.IllegalArgumentException: A child with id 'email_feedback' already exists: [MarkupContainer [Component id = registrationForm]] at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:145) at com.spidertracks.aviator.logbook.html.BaseFeedbackForm $FeedBackVisitor.formComponent(BaseFeedbackForm.java:76) at org.apache.wicket.markup.html.form.Form$9.component(Form.java:1192) at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:878) at org.apache.wicket.markup.html.form.Form.visitFormComponents(Form.java:1188) at com.spidertracks.aviator.logbook.html.BaseFeedbackForm.onBeforeRender(BaseFeedbackForm.java:52) at org.apache.wicket.Component.internalBeforeRender(Component.java:1061) at org.apache.wicket.Component.beforeRender(Component.java:1095) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1727) ... 43 more Should I not be using onBeforeRender in this way, and instead using a listener for when the components are added to the form? I'm new to wicket, so any help would be greatly appreciated. thanks, Todd