コード例 #1
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();
 }
コード例 #2
0
 public void testInterceptingUsingAButtonTrigger() throws Exception {
   Button button = new Button(new JButton(new ShowDialogAction(true)));
   Window window = WindowInterceptor.getModalDialog(button.triggerClick());
   window.titleEquals("MyDialog");
   window.dispose();
 }