コード例 #1
0
 public void testInterceptionWithATriggerThatDisplaysNothing() throws Exception {
   try {
     WindowInterceptor.getModalDialog(Trigger.DO_NOTHING);
     throw new AssertionFailureNotDetectedError();
   } catch (AssertionError e) {
     assertEquals(
         ShownInterceptionDetectionHandler.NO_WINDOW_WAS_SHOWN_ERROR_MESSAGE, e.getMessage());
   }
 }
コード例 #2
0
 public void testInterceptingANonModalJDialog() throws Exception {
   try {
     WindowInterceptor.getModalDialog(
         new Trigger() {
           public void run() {
             JDialog dialog = new JDialog();
             dialog.setTitle("aDialog");
             dialog.setVisible(true);
           }
         });
     throw new AssertionFailureNotDetectedError();
   } catch (AssertionError e) {
     assertEquals(
         "Window 'aDialog' is non-modal, it must be intercepted with WindowInterceptor.run(Trigger)",
         e.getMessage());
   }
 }