### Question:
ModalDialog implements ClientElement { @AfterRender void addJavaScript() { JSONObject params = new JSONObject(); params.put("id", getClientId()); params.put("event", clientEvent); params.put("openLink", getPageLink()); params.put("closeLink", getCloseLink()); params.put("zone", zone); params.put("options", getInformalParametersAsJSON()); javaScriptSupport.addInitializerCall("setupModalDialog", params); } ModalDialog();   ModalDialog(JavaScriptSupport javaScriptSupport,
         ComponentResources resources); String getClientId();  }### Answer:
@Test public void check_proper_call_to_javascript_function_is_made() { JavaScriptSupport javaScriptSupport = mockJavaScriptSupport(); ComponentResources resources = mockComponentResources(); ModalDialog dialog = new ModalDialog(javaScriptSupport, resources); expect(resources.getInformalParameterNames()).andReturn(CollectionFactory.newList("testparam")); expect(resources.getInformalParameter("testparam", String.class)).andReturn("testvalue"); Link openLink = mockLink(); expect(openLink.toAbsoluteURI()).andReturn("testpagelink"); expect(resources.createEventLink(TawusAddonsEventConstants.SHOW_DIALOG, (Object[])null)).andReturn(openLink); Link closeLink = mockLink(); expect(closeLink.toAbsoluteURI()).andReturn("closelink"); expect(resources.createEventLink(TawusAddonsEventConstants.CLOSE_DIALOG)).andReturn(closeLink); JSONObject params = new JSONObject(); params.put("id", null); params.put("openLink", "testpagelink"); params.put("closeLink", "closelink"); JSONObject options = new JSONObject(); options.put("testparam", "testvalue"); params.put("options", options); javaScriptSupport.addInitializerCall("setupModalDialog", params); replay(); dialog.addJavaScript(); verify(); }