Re: WicketTester vs Component.error()

2007-08-08 Thread Gabor Szokoli
On 8/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 in 1.2 you cannot call error/info/etc from component's constructor because
 you havent added that component to the page yet. in 1.3 it just works.

Indeed.
I was under the false impression that this function worked on regular
deployment, but the error message is exactly the same.
Yay for unit testing! :-)


Gabor

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WicketTester vs Component.error()

2007-08-07 Thread Igor Vaynberg
in 1.2 you cannot call error/info/etc from component's constructor because
you havent added that component to the page yet. in 1.3 it just works.

-igor


On 8/7/07, Gabor Szokoli [EMAIL PROTECTED] wrote:

 Hi,

 I'm using wicket 1.2, and use the WicketTester startPage(...) method
 in a unit test.
 (In fact there's nothing else in it, I just want to test if the markup
 matches the component hierarchy.)
 Problem is, a component on the page uses its error(...) method to
 display its dissatisfaction with the mock data in a feedbackpanel,
 which is perfectly normal operation.
 But that causes an exception:

 java.lang.IllegalStateException: No Page found for component
 [MarkupContainer [Component id = signInForm, page = No Page, path =
 signInForm.LoginPanel$SignInForm]]

 Is this expected? Did I do something wrong?

 Any advice is appreciated.
 Upgrading to wicket 1.3 is planned, but I'd rather have tests even before
 that.


 Thank you for your attention and the great framework!

 Gabor

 Ps: Here's the full output:


 SEVERE: tester: unexpected
 wicket.WicketRuntimeException: tester: unexpected
 at wicket.util.tester.WicketTester.convertoUnexpect(
 WicketTester.java:381)
 at wicket.util.tester.WicketTester.access$200(WicketTester.java
 :178)
 at wicket.util.tester.WicketTester$3.getTestPanel(
 WicketTester.java:365)
 at wicket.util.tester.DummyPanelPage.init(DummyPanelPage.java
 :40)
 at wicket.util.tester.WicketTester$2.getTestPage(WicketTester.java
 :336)
 at wicket.util.tester.DummyHomePage$TestLink.onClick(
 DummyHomePage.java:84)
 at wicket.markup.html.link.Link.onLinkClicked(Link.java:254)
 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 wicket.RequestListenerInterface.invoke(
 RequestListenerInterface.java:187)
 at
 wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents
 (ListenerInterfaceRequestTarget.java:74)
 at
 wicket.request.compound.DefaultEventProcessorStrategy.processEvents(
 DefaultEventProcessorStrategy.java:65)
 at
 wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents
 (AbstractCompoundRequestCycleProcessor.java:57)
 at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java
 :896)
 at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
 :929)
 at wicket.RequestCycle.step(RequestCycle.java:1010)
 at wicket.RequestCycle.steps(RequestCycle.java:1084)
 at wicket.RequestCycle.request(RequestCycle.java:454)
 at wicket.protocol.http.MockWebApplication.processRequestCycle(
 MockWebApplication.java:318)
 at wicket.protocol.http.MockWebApplication.processRequestCycle(
 MockWebApplication.java:307)
 at wicket.util.tester.WicketTester.newRequestToComponent(
 WicketTester.java:248)
 at wicket.util.tester.WicketTester.startPage(WicketTester.java
 :235)
 at wicket.util.tester.WicketTester.startPanel(WicketTester.java
 :330)
 at com.deverto.centrex.panels.LoginPanelTest.testForm(
 LoginPanelTest.java:26)
 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 junit.framework.TestCase.runTest(TestCase.java:164)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:228)
 at junit.framework.TestSuite.run(TestSuite.java:223)
 at org.junit.internal.runners.OldTestClassRunner.run(
 OldTestClassRunner.java:35)
 at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(
 JUnit4TestSet.java:62)
 at
 org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
 AbstractDirectoryTestSuite.java:138)
 at
 org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
 AbstractDirectoryTestSuite.java:125)
 at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(
 NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 DelegatingMethodAccessorImpl.java:25)