} else { ajaxOperation = AjaxHelper.getAjaxOperation(triggerId);
@Test public void testPreparePaintComponent() { WApplication app = new WApplication(); AjaxTrigger trigger = new WButton(); AjaxTarget target = new WPanel(); WAjaxControl control = new WAjaxControl(trigger, target); app.add(control); app.add(trigger); app.add(target); app.setLocked(true); UIContext uic = createUIContext(); uic.setUI(app); setActiveContext(uic); MockRequest req = new MockRequest(); control.handleRequest(req); control.preparePaint(req); AjaxOperation ajaxOperation = AjaxHelper.getAjaxOperation(trigger.getId()); Assert.assertNotNull("Ajax operation should have been registered", ajaxOperation); Assert.assertEquals("Incorrect ajax operation trigger id", trigger.getId(), ajaxOperation. getTriggerId()); Assert.assertEquals("Incorrect ajax operation targets", target.getId(), ajaxOperation. getTargets().get(0)); }