public void testWizardPageDispose() {
    wizard.page2.setThrowExceptionOnDispose(true);
    final boolean logged[] = new boolean[1];
    Policy.setLog(
        new ILogger() {
          @Override
          public void log(IStatus status) {
            logged[0] = true;
          }
        });
    dialog.close();

    assertTrue(logged[0]);
    assertTrue(wizard.page1.getControl().isDisposed());
    assertTrue(wizard.page3.getControl().isDisposed());
  }
  public void testWizardDispose() {
    wizard.setThrowExceptionOnDispose(true);

    final boolean logged[] = new boolean[1];
    Policy.setLog(
        new ILogger() {
          @Override
          public void log(IStatus status) {
            logged[0] = true;
          }
        });
    Shell shell = dialog.getShell();
    dialog.close();

    assertTrue(logged[0]);

    shell.dispose();
  }
 @Override
 protected void tearDown() throws Exception {
   if (dialog.getShell() != null && !dialog.getShell().isDisposed()) {
     dialog.close();
   }
 }