public void doTest() throws Exception {

    try {
      dialog.activated.waitForFlagTriggered();
      assertTrue(
          dialog.activated.flag(),
          "Dialog did not trigger " + "Window Activated event when it became visible");

      dialog.closeGained.waitForFlagTriggered();
      assertTrue(
          dialog.closeGained.flag(),
          "the 1st Dialog button " + "did not gain focus when it became visible");

      assertTrue(
          dialog.closeButton.hasFocus(),
          "the 1st Dialog button " + "gained the focus but lost it afterwards");

      dialog.checkUnblockedDialog(robot, "Modal Dialog shouldn't be blocked.");

      if ((modalityType == Dialog.ModalityType.APPLICATION_MODAL)
          || (modalityType == Dialog.ModalityType.DOCUMENT_MODAL)
          || (modalityType == Dialog.ModalityType.TOOLKIT_MODAL)
          || dialog.isModal()) {
        parent.checkBlockedDialog(
            robot, "Dialog is the parent of a visible " + modalityType + " Dialog.");
      } else {
        parent.checkUnblockedDialog(
            robot, "Dialog is the parent of a visible " + modalityType + " Dialog.");
      }

      robot.waitForIdle(delay);
    } finally {
      EventQueue.invokeAndWait(this::closeAll);
    }
  }
  public void doTest() throws Exception {

    try {

      robot.waitForIdle(delay);

      for (DialogOwner owner : DialogOwner.values()) {

        EventQueue.invokeLater(
            () -> {
              createGUI(owner);
            });

        robot.waitForIdle(delay);

        dialog.activated.waitForFlagTriggered();
        assertTrue(
            dialog.activated.flag(),
            "Dialog did not trigger " + "Window Activated event when it became visible");

        dialog.closeGained.waitForFlagTriggered();
        assertTrue(
            dialog.closeGained.flag(),
            "The 1st button did not " + "gain focus when the dialog became visible");

        dialog.checkUnblockedDialog(robot, "");
        robot.waitForIdle(delay);
      }

    } finally {
      EventQueue.invokeAndWait(this::closeAll);
    }
  }