Wicket JUnit Troubleshooting

AJAX Form Submission

The submit() method on the FormTester class won’t submit AJAX buttons (for example, the IndicatingAjaxButton). (Although the method can be used to test form validation). In order to execute the onSubmit method of an AJAX control, you must use the executeAjaxEvent() method on the WicketTester class.

tester.executeAjaxEvent(PATH_TO_AJAX_BUTTON, "onclick");

Argument pageClass must be not null

java.lang.IllegalArgumentException: Argument pageClass must be not null

This may occur because you are creating a fake web application for unit testing so you can do spring injections. If you create your own sub-class of an Application, it must not return a null value for getHomePage(). If nothing else, return the BasePage class.

It's only fair to share...
Share on Facebook
Facebook
Google+
Google+
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Leave a Reply