Reputation: 2497
I have created a linkpage FooPage, sothat when somebody clicks on this link, some text "test test"
is desplayed to the user, so far good.
I have created the folloing basic page:
FooPage.java
public class FooPage extends WebPage {
public FooPage() {
add(new Label("label", "test test"));
} }
FooPage.html
<div wicket:id="label"></div>
In MyPnel.java I add the created page as follow:
MyPanel.java
public class MyPanel extends Panel{
add(new BookmarkablePageLink<Void>("foobar", FooPage.class));
}
MyPanel.html:
<a wicket:id="foobar" href="FooPage"></a>
Now when I test the created component with junit as follows:
@Test
public void startPage() {
wicketTester.assertComponent("foobar", FooPage.class);
}
I get the following error:
junit.framework.AssertionFailedError: component 'BookmarkablePageLink' is not type:FooPage
Any idea what is the problem or hot to solve this?
Upvotes: 0
Views: 321
Reputation: 9345
As Ian already said, assertComponent
checks that the type of the component is a subtype of a class. For your usecase you should use
wicketTester.assertBookmarkablePageLink("foobar", FooPage.class, new PageParameters());
Upvotes: 2
Reputation: 760
Should you not try
wicketTester.assertComponent("foobar", BookmarkablePageLink.class);
instead (since the component of ID "foobar" is of type BookmarkablePageLink
)?
Upvotes: 2