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 <[email protected]>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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to