コード例 #1
0
 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());
 }
コード例 #2
0
 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();
 }