public void testInterceptingAModalDialog() throws Exception {
   Window window =
       WindowInterceptor.getModalDialog(
           new Trigger() {
             public void run() {
               logger.log("triggerRun");
               JDialog dialog = createModalDialog("aDialog");
               addHideButton(dialog, "OK");
               dialog.setVisible(true);
             }
           });
   logger.assertEquals("<log>" + "  <triggerRun/>" + "</log>");
   assertTrue(window.isVisible());
   window.getButton("OK").click();
   logger.assertEquals("<log>" + "  <click button='OK'/>" + "</log>");
   assertFalse(window.isVisible());
 }
 public void testInterceptingAJDialogShownFromAnotherThread() throws Exception {
   Window window =
       WindowInterceptor.getModalDialog(
           new Trigger() {
             public void run() throws Exception {
               thread =
                   new Thread() {
                     public void run() {
                       JDialog dialog = createModalDialog("expected title");
                       addHideButton(dialog, "OK");
                       dialog.setVisible(true);
                     }
                   };
               thread.start();
             }
           });
   window.titleEquals("expected title");
   window.getButton("OK").click();
   assertFalse(window.isVisible());
   window.dispose();
 }