Hi, Currently AjaxRequestTarget (ART) is not very extendable because some of its methods are final. The same reason makes it impossible to use a mock instance for unit tests (pure unit test, not wicket tester test). Trying to instantiate ART is also not possible because it uses "RequestCycle.get()" in its constructor and ThreadContext.setRequestCycle() accepts RequestCycle, the class, not IRequestCycle - the interface, and this leads to creating mocks of several transitive dependencies to be able to use ART.
In long term (maybe when we fix the packages split problem) I think we have to introduce IAjaxRequestHandler and change all signatures (onClick, onEvent, ...) to receive it instead of ART. This will also allow passing of NoopART as some people asked for. And maybe Optional<ART> wont be needed for AjaxFallback** components ?! In short term removing "final" from method signatures would allow to mock it for tests and return customized impl from org.apache.wicket.protocol.http.WebApplication.getAjaxRequestTargetProvider(). I know 'final's helps to keep the framework stable by not allowing the user to override critical pieces of the functionality but I don't see better solution. What do you think ? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com
