You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sudeivas <su...@gmail.com> on 2011/11/15 21:04:52 UTC
NullPointerException in WicketTester
Hello,
I am trying to write some unit tests for my wicket application. My
webpage has a custom constructor.
public DefaultErrorPage(String message) {
add(new Label("message", message);
}
For this, I followed the steps mentioned in
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/util/tester/WicketTester.html
I used ITestPageSource() to call the webpage. But my unit test is throwing a
null pointer exception at
MockHttpServletRequest.setRequestToComponent();
below is my code:
@Before
public void init() {
tester = new WicketTester();
}
@Test
public void testErrorPage() {
tester.startPage(new ITestPageSource() {
@Override
public Page getTestPage() {
return new DefaultErrorPage("Hello");
}
});
tester.assertRenderPage(DefaultErroPage.class);
}
Apache Wicket - 1.4.5
Please help me with some information.
-Suresh
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4073967.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by sudeivas <su...@gmail.com>.
Finally got the issue resolved. I removed the dependency on wicket-velocity
and also I was using some mock libraries. Removed everything and tried a
simple test case and it worked.
Thanks
Suresh
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4078074.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by Igor Vaynberg <ig...@gmail.com>.
there are hundreds of tests in the wicket jar, and they work just fine...
-igor
On Wed, Nov 16, 2011 at 8:43 AM, sudeivas <su...@gmail.com> wrote:
> Has anyone successfully written unit tests under 1.5.3? If yes, I could use
> some documentation.
>
> I saw this jira - https://issues.apache.org/jira/browse/WICKET-4045 when I
> did some research on this issue.
>
> Pls help to fix this.
>
> -Suresh
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by sudeivas <su...@gmail.com>.
Thanks for the update. I add velocity.jar to my classpath. Now I am getting
PageExpiredException.
org.apache.wicket.protocol.http.PageExpiredException: Page with id '0' has
expired.
at
org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:169)
at
org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2578)
at
org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2565)
at
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:166)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at
org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:626)
at
org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:676)
at
org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:546)
at
org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:757)
at
org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:773)
at xxxTest.xxxxTest(xxxTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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)
Has anyone successfully written unit tests under 1.5.3? If yes, I could use
some documentation.
I saw this jira - https://issues.apache.org/jira/browse/WICKET-4045 when I
did some research on this issue.
Pls help to fix this.
-Suresh
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4076980.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
This exception means that you have wicket-velocity.jar in the
classpath but velocity.jar is not there.
On Wed, Nov 16, 2011 at 4:21 AM, sudeivas <su...@gmail.com> wrote:
> I upgraded from 1.4 to 1.5.3. Now I am getting a different error,
>
> Stack trace:
>
> java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity
> at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
> at org.apache.wicket.Application.callInitializers(Application.java:605)
> at org.apache.wicket.Application.initializeComponents(Application.java:515)
> at org.apache.wicket.Application.initApplication(Application.java:808)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
> at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
> at xxxTest.init(xxxTest.java:61)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
> 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.ClassNotFoundException:
> org.apache.velocity.app.Velocity
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
> at org.apache.wicket.Application.callInitializers(Application.java:605)
> at org.apache.wicket.Application.initializeComponents(Application.java:515)
> at org.apache.wicket.Application.initApplication(Application.java:808)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
> at
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
> at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
> at xxxTest.init(xxxTest.java:61)
> 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
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:53)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> 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)
> ... 6 more
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4075050.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by Igor Vaynberg <ig...@gmail.com>.
are you not using maven?
-igor
On Tue, Nov 15, 2011 at 6:21 PM, sudeivas <su...@gmail.com> wrote:
> I upgraded from 1.4 to 1.5.3. Now I am getting a different error,
>
> Stack trace:
>
> java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity
> at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
> at
> org.apache.wicket.Application.callInitializers(Application.java:605)
> at
> org.apache.wicket.Application.initializeComponents(Application.java:515)
> at
> org.apache.wicket.Application.initApplication(Application.java:808)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
> at
> org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
> at xxxTest.init(xxxTest.java:61)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
> 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.ClassNotFoundException:
> org.apache.velocity.app.Velocity
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
> at
> org.apache.wicket.Application.callInitializers(Application.java:605)
> at
> org.apache.wicket.Application.initializeComponents(Application.java:515)
> at
> org.apache.wicket.Application.initApplication(Application.java:808)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
> at
>
> org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
> at
> org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
> at xxxTest.init(xxxTest.java:61)
> 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
>
> mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:53)
> at
>
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
> at
>
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> 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)
> ... 6 more
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4075050.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: NullPointerException in WicketTester
Posted by sudeivas <su...@gmail.com>.
I upgraded from 1.4 to 1.5.3. Now I am getting a different error,
Stack trace:
java.lang.NoClassDefFoundError: org/apache/velocity/app/Velocity
at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
at org.apache.wicket.Application.callInitializers(Application.java:605)
at org.apache.wicket.Application.initializeComponents(Application.java:515)
at org.apache.wicket.Application.initApplication(Application.java:808)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
at xxxTest.init(xxxTest.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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.ClassNotFoundException:
org.apache.velocity.app.Velocity
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.wicket.velocity.Initializer.init(Initializer.java:60)
at org.apache.wicket.Application.callInitializers(Application.java:605)
at org.apache.wicket.Application.initializeComponents(Application.java:515)
at org.apache.wicket.Application.initApplication(Application.java:808)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:303)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:247)
at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:217)
at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:170)
at xxxTest.init(xxxTest.java:61)
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
mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:53)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
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)
... 6 more
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4075050.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by sudeivas <su...@gmail.com>.
Stack Trace:
java.lang.NullPointerException
at
org.apache.wicket.protocol.http.MockHttpServletRequest.setRequestToComponent(MockHttpServletRequest.java:1222)
at
org.apache.wicket.util.tester.BaseWicketTester.executeListener(BaseWicketTester.java:260)
at
org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:246)
at xxx.widgets.xxxx.xxxxTest(xxxTest.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
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)
I even tried tester.startPaget(new DefaultErrorPage("hello"));
But still I am getting the same error.
Thanks
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4074172.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: NullPointerException in WicketTester
Posted by Igor Vaynberg <ig...@gmail.com>.
it is usually helpful to post a strack trace. also, isnt there a
tester.startPage(Page)?
-igor
On Tue, Nov 15, 2011 at 12:04 PM, sudeivas <su...@gmail.com>wrote:
> Hello,
> I am trying to write some unit tests for my wicket application. My
> webpage has a custom constructor.
>
> public DefaultErrorPage(String message) {
> add(new Label("message", message);
> }
>
>
> For this, I followed the steps mentioned in
>
> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/util/tester/WicketTester.html
>
> I used ITestPageSource() to call the webpage. But my unit test is throwing
> a
> null pointer exception at
>
> MockHttpServletRequest.setRequestToComponent();
>
> below is my code:
>
> @Before
> public void init() {
> tester = new WicketTester();
> }
>
> @Test
> public void testErrorPage() {
> tester.startPage(new ITestPageSource() {
> @Override
> public Page getTestPage() {
> return new DefaultErrorPage("Hello");
> }
> });
> tester.assertRenderPage(DefaultErroPage.class);
> }
>
> Apache Wicket - 1.4.5
>
> Please help me with some information.
>
> -Suresh
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/NullPointerException-in-WicketTester-tp4073967p4073967.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>