Bjørn Grønbæk | 9 Feb 21:59
Favicon

Very simple Wicket test to verify panel type...

Hi,

I'm just starting out with Wicket and WicketTester...

I have a page that adds one of several panels, depending of its
PageParameter. I would like to verify that behaviour with WicketTester...
but how to?

The code is something like this:

        String type = null;
        Panel p = null;

        if(getPageParameters() != null)
            type = getPageParameters().getString("BRAND_TYPE");

        if(type != null && type.equals("BRAND"))
            p = new PanelA(id);
        else
            p = new PanelB(id);
         add(p);

I've tried something like this:

wicketTester.startPage(CreatePage.class);
wicketTester.assertRenderedPage(CreatePage.class);
wicketTester.assertComponent(":panelid",PanelA.class);

but that doesn't work. The test fails with this message:
junit.framework.AssertionFailedError: component 'CreatePage' is not
type:PanelA

Am I using the AssertComponent in a wrong way?
How else can I perform a test like that?
Could you point me to a good resource on how I find the path to components?

--

-- 

Best Regard

Bjørn Grønbæk

Software Engineer

m: bjorn.gronbaek <at> endomondo.com <first%20name.last%20name <at> endomondo.com>
p: +45 22669501
w: *www.endomondo.com* <http://www.endomondo.com/>
t: *www.twitter.com/endomondo* <http://www.twitter.com/endomondo>
f:* **www.facebook.com/endomondo* <http://www.facebook.com/endomondo>
e: www.endomondo.com/profile/406738 <http://www.endomondo.com/profile/your>

Gmane