You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gustavo Henrique <gu...@gmail.com> on 2010/04/11 16:03:25 UTC

problem with WicketTester to load template

hi guys!
I have been a problem using WicktTester. When I run a simple test, wicket
throws an exception because can't load the template html. But if I access
page via browser, wicket works fine.

the source code:

CustomerApplicationTest.java
http://pastebin.com/tRJ9hNuk

Example.java
http://pastebin.com/CW8BDPYE

ExampleTest.java
http://pastebin.com/uBBRAcSW

Example.html
<html>
<body>
<input type="text" wicket:id="username" id="username">
</body>
</html>

Thanks!

Re: problem with WicketTester to load template

Posted by Gustavo Henrique <gu...@gmail.com>.
Yes, the problem is the word void in the constructor. Now is ok!
Thank you guys!

Re: problem with WicketTester to load template

Posted by Per Newgro <pe...@gmx.ch>.
Am 12.04.2010 16:58, schrieb Gustavo Henrique:
> I'm sorry! Blank is the constructor. It is a wrong word, because in my
> source the class name is Blank (only for test) and I renamed for Example in
> this post!
>
>    
Blank is not a constructor - it's a method.
If you want it to be constructor, remove the void return value.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problem with WicketTester to load template

Posted by Per Newgro <pe...@gmx.ch>.
It's always easier to check the real failing code.
If you exchange only half of the appropriate words it's hard to find the 
error.

Cheers
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problem with WicketTester to load template

Posted by Gustavo Henrique <gu...@gmail.com>.
I'm sorry! Blank is the constructor. It is a wrong word, because in my
source the class name is Blank (only for test) and I renamed for Example in
this post!

Re: problem with WicketTester to load template

Posted by Per Newgro <pe...@gmx.ch>.
This looks strange to me:

public class Example extends WebPage {

     public void Blank() {
         add(new RequiredTextField("username"));
     }
}

Why is Blank a Uppercase method name?
You don't have any constructor yet. So Blank never gets executed and the 
username component is not added to the page

try

public class Example extends WebPage {

     public Example() {
         add(new RequiredTextField("username"));
     }
}

or

public class Example extends WebPage {

     public Example() {
       Blank();
     }

     public void Blank() {
         add(new RequiredTextField("username"));
     }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problem with WicketTester to load template

Posted by Gustavo Henrique <gu...@gmail.com>.
org.apache.wicket.WicketRuntimeException: path: 'Example:username' does not
exist for page: Example
    at
org.apache.wicket.util.tester.BaseWicketTester.fail(BaseWicketTester.java:1344)
    at
org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:472)
    at
com.b2w.controlpanel.test.page.LoginTest.testLoginPageComponents(LoginTest.java:23)
    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:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


Thanks!

Re: problem with WicketTester to load template

Posted by Per Newgro <pe...@gmx.ch>.
 > When I run a simple test, wicket throws an exception because can't 
load the template html.

Do you have a stacktrace?

Cheers
Per



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org