Package org.eclipse.jdt.internal.junit.util

Examples of org.eclipse.jdt.internal.junit.util.JUnitStatus


        if (selection[i] instanceof IType) {
          count++;
        }
      }
      if (count == 0 && !fEmptySelectionAllowed) {
        return new JUnitStatus(IStatus.ERROR, ""); //$NON-NLS-1$
      }

      IStatus recursiveInclusionStatus = checkRecursiveSuiteInclusion(selection);
      if (recursiveInclusionStatus != null
          && !recursiveInclusionStatus.isOK())
        return recursiveInclusionStatus;

      String message;
      if (count == 1) {
        message = Messages
            .format(
                WizardMessages.UpdateAllTests_selected_methods_label_one,
                new Integer(count));
      } else {
        message = Messages
            .format(
                WizardMessages.UpdateAllTests_selected_methods_label_many,
                new Integer(count));
      }
      return new JUnitStatus(IStatus.INFO, message);
    }
View Full Code Here


    private IStatus checkRecursiveSuiteInclusion(Object[] selection) {
      for (int i = 0; i < selection.length; i++) {
        if (selection[i] instanceof IType) {
          if (((IType) selection[i]).equals(fTestSuite)) {
            return new JUnitStatus(
                IStatus.WARNING,
                WizardMessages.UpdateTestSuite_infinite_recursion);
          }
        }
      }
View Full Code Here

    if (!status.isOK())
      return status;
    status = Resources.makeCommittable(filesToModify, null);
    if (!status.isOK())
      return status;
    return new JUnitStatus();
  }
View Full Code Here

  public NewTestSuite4WizardPage() {
    super(true, PAGE_NAME);
    setTitle(WizardMessages.NewTestSuiteWizPage_title);
    setDescription(WizardMessages.NewTestSuiteWizPage_description);

    fClassesInSuiteStatus = new JUnitStatus();
  }
View Full Code Here

  public boolean hasUpdatedExistingClass() {
    return fUpdatedExistingClassButton;
  }

  private IStatus classesInSuiteChanged() {
    JUnitStatus status = new JUnitStatus();
    if (fClassesInSuiteTable.getCheckedElements().length <= 0)
      status.setWarning(WizardMessages.NewTestSuiteWizPage_classes_in_suite_error_no_testclasses_selected);
    return status;
  }
View Full Code Here

   * @see org.eclipse.jdt.ui.wizards.NewTypeWizardPage#typeNameChanged()
   */
  protected IStatus typeNameChanged() {
    super.typeNameChanged();

    JUnitStatus status = new JUnitStatus();
    String typeName = getTypeName();
    // must not be empty
    if (typeName.length() == 0) {
      status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_empty);
      return status;
    }
    if (typeName.indexOf('.') != -1) {
      status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_qualified);
      return status;
    }

    IStatus val = JavaConventionsUtil.validateJavaTypeName(typeName,
        getJavaProject());
    if (val.getSeverity() == IStatus.ERROR) {
      status.setError(WizardMessages.NewTestSuiteWizPage_typeName_error_name_not_valid
          + val.getMessage());
      return status;
    } else if (val.getSeverity() == IStatus.WARNING) {
      status.setWarning(WizardMessages.NewTestSuiteWizPage_typeName_error_name_name_discouraged
          + val.getMessage());
      // continue checking
    }

    IStatus recursiveSuiteInclusionStatus = checkRecursiveTestSuiteInclusion();
    if (!recursiveSuiteInclusionStatus.isOK())
      return recursiveSuiteInclusionStatus;

    IPackageFragment pack = getPackageFragment();
    if (pack != null) {
      ICompilationUnit cu = pack.getCompilationUnit(typeName + ".java"); //$NON-NLS-1$
      if (cu.exists()) {
        status.setWarning(WizardMessages.NewTestSuiteWizPage_typeName_warning_already_exists);
        return status;
      }
    }
    return status;
  }
View Full Code Here

    return status;
  }

  private IStatus checkRecursiveTestSuiteInclusion() {
    if (fClassesInSuiteTable == null)
      return new JUnitStatus();
    String typeName = getTypeName();
    JUnitStatus status = new JUnitStatus();
    Object[] checkedClasses = fClassesInSuiteTable.getCheckedElements();
    for (int i = 0; i < checkedClasses.length; i++) {
      IType checkedClass = (IType) checkedClasses[i];
      if (checkedClass.getElementName().equals(typeName)) {
        status.setWarning(WizardMessages.NewTestSuiteCreationWizardPage_infinite_recursion);
        return status;
      }
    }
    return new JUnitStatus();
  }
View Full Code Here

    fMethodStubsButtons = new MethodStubsSelectionButtonGroup(SWT.CHECK, buttonNames, 2);
    fMethodStubsButtons.setLabelText(WizardMessages.NewCamelTestWizardPageOne_method_Stub_label);

    fXmlFileToTestCompletionProcessor = new JavaTypeCompletionProcessor(false, false, true);

    fXmlFileUnderTestStatus = new JUnitStatus();

    fXmlFileUnderTestText = ""; //$NON-NLS-1$

    fJunit4Status = new JUnitStatus();
    fIsJunit4 = false;
  }
View Full Code Here

  public boolean isJUnit4() {
    return fIsJunit4;
  }

  private IStatus junit4Changed() {
    JUnitStatus status = new JUnitStatus();
    return status;
  }
View Full Code Here

    IStatus stat = super.superClassChanged();
    if (stat.getSeverity() != IStatus.OK) {
      return stat;
    }
    String superClassName = getSuperClass();
    JUnitStatus status = new JUnitStatus();
    boolean isJUnit4 = isJUnit4();
    if (superClassName == null || superClassName.trim().equals("")) { //$NON-NLS-1$
      if (!isJUnit4) {
        status.setError(WizardMessages.NewCamelTestWizardPageOne_error_superclass_empty);
      }
      return status;
    }
    if (isJUnit4 && superClassName.equals("java.lang.Object")) {
      return status;
    }
    if (getPackageFragmentRoot() != null) {
      try {
        IType type = resolveClassNameToType(getPackageFragmentRoot().getJavaProject(), getPackageFragment(),
            superClassName);
        if (type == null) {
          status.setWarning(WizardMessages.NewCamelTestWizardPageOne_error_superclass_not_exist);
          return status;
        }
        if (type.isInterface()) {
          status.setError(WizardMessages.NewCamelTestWizardPageOne_error_superclass_is_interface);
          return status;
        }
        if (!isJUnit4 && !CoreTestSearchEngine.isTestImplementor(type)) { // TODO:
          // expensive!
          status.setError(Messages.format(
              WizardMessages.NewCamelTestWizardPageOne_error_superclass_not_implementing_test_interface,
              BasicElementLabels.getJavaElementName(JUnitCorePlugin.TEST_INTERFACE_NAME)));
          return status;
        }
      } catch (JavaModelException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.junit.util.JUnitStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.