How to unit-test a Wicket component with AbstractAjaxTimerBehavior?
        Posted  
        
            by 
                Juha Syrjälä
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Juha Syrjälä
        
        
        
        Published on 2011-02-04T07:21:26Z
        Indexed on 
            2011/02/04
            7:25 UTC
        
        
        Read the original article
        Hit count: 295
        
I have a Wicket panel that has AbstractAjaxTimeBehavior, that I'd like to unit test. How can I trigger a ajax event during the unit test that end up calling AbstractAjaxTimeBehavior's .onTimer(AjaxRequestTarget target) method?
behavior = new AbstractAjaxTimerBehavior(Duration.seconds(pollingPeriodInSeconds)) {
  protected void onTimer(AjaxRequestTarget target) {
     // how to unit test this?
  }
}
add(behavior);
© Stack Overflow or respective owner