/** Check new file wizard values */
  private void checkNewFileWizardValues(NewFileWizardOperator nfwo, String fileType) {

    String description = null;

    // Check New File Wizard description
    if (fileType.equals(FILE_TYPE_STANDARD_MBEAN)) {
      description = STANDARD_MBEAN_NEW_FILE_DESCRIPTION;
    } else if (fileType.equals(FILE_TYPE_MXBEAN)) {
      description = MXBEAN_NEW_FILE_DESCRIPTION;
    } else if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)) {
      description = MBEAN_FROM_EXISTING_JAVA_CLASS_NEW_FILE_DESCRIPTION;
    } else if (fileType.equals(FILE_TYPE_STANDARD_MBEAN_WITH_METADATA)) {
      description = STANDARD_MBEAN_WITH_METADATA_NEW_FILE_DESCRIPTION;
    }
    assertEquals(description, nfwo.txtDescription().getDisplayedText());
  }
  /** Check new file wizard components are enabled/disabled */
  private void checkNewFileWizardComponents(NewFileWizardOperator nfwo) {

    // Check text fields
    assertFalse(nfwo.txtDescription().isEditable());

    // Checks buttons
    assertFalse(nfwo.btBack().isEnabled());
    assertTrue(nfwo.btNext().isEnabled());
    assertFalse(nfwo.btFinish().isEnabled());
    assertTrue(nfwo.btCancel().isEnabled());
    assertFalse(nfwo.btHelp().isEnabled());
  }
  /** Test name and location wizard */
  private void testNameAndLocationWizard(String fileType, String mbeanDefaultClassName) {

    System.out.println("File type is " + fileType);

    MBean mbean = null;

    // New File wizard execution
    NewFileWizardOperator nfwo =
        newFileWizardFromMenu(PROJECT_NAME_MBEAN_FUNCTIONAL, FILE_CATEGORY_JMX, fileType);
    // Check new file wizard components
    checkNewFileWizardComponents(nfwo);
    // Check new file wizard values
    checkNewFileWizardValues(nfwo, fileType);
    nfwo.next();

    NewJavaFileNameLocationStepOperator nfnlso = nameAndLocationWizard(null, null);

    // Check name and location wizard components
    checkNameAndLocationWizardComponents(nfnlso, fileType, null);
    // Check name and location wizard default values
    mbean =
        new MBean(
            mbeanDefaultClassName,
            null,
            "",
            mbeanDefaultClassName + " Description",
            "",
            false,
            null,
            null,
            null);
    checkNameAndLocationWizardValues(nfnlso, fileType, PROJECT_NAME_MBEAN_FUNCTIONAL, mbean);

    // Update some values
    // Perform back/next actions
    // Check no data has been lost
    mbean =
        new MBean(
            "MyNewClassName",
            null,
            PACKAGE_COM_FOO_BAR,
            "My New Description",
            PACKAGE_COM_FOO_BAR + "." + EMPTY_JAVA_CLASS_NAME,
            true,
            null,
            null,
            null);
    updateNameAndLocationWizardValues(nfnlso, fileType, mbean);
    nfnlso.back();
    nfnlso.next();
    // Check name and location wizard components
    checkNameAndLocationWizardComponents(nfnlso, fileType, mbean);
    // Check name and location wizard values
    checkNameAndLocationWizardValues(nfnlso, fileType, PROJECT_NAME_MBEAN_FUNCTIONAL, mbean);
    if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)
        || fileType.equals(FILE_TYPE_STANDARD_MBEAN_WITH_METADATA)) {
      nfnlso.next();
      nfnlso.back();
      // Check name and location wizard components
      checkNameAndLocationWizardComponents(nfnlso, fileType, mbean);
      // Check name and location wizard values
      checkNameAndLocationWizardValues(nfnlso, fileType, PROJECT_NAME_MBEAN_FUNCTIONAL, mbean);
    }

    // Check warnings
    checkNameAndLocationWizardWarnings(nfnlso, fileType);

    nfnlso.cancel();
  }