如何在 wicket 的测试中模拟点击 AjaxButton?

How to emulate clicking on an AjaxButton in the wicket's test?

我的测试中有以下代码:

    AjaxButton button = (AjaxButton) getTester().getComponentFromLastRenderedPage(path);
    Assert.assertNotNull(button);
    getTester().clickLink(button); // fails with exception "is not an instance of AbstractLink or IAjaxLink"

我应该在最后一行写什么来强制 WicketTester 按下 AjaxButton?

使用'executeAjaxEvent':

tester.executeAjaxEvent(button, "click");