public boolean isPotentialTestMethod(JSFunction method) {
    if (method.getKind() == JSFunction.FunctionKind.CONSTRUCTOR) return false;

    PsiElement parent = method.getParent();
    if (parent instanceof JSClass
        && (isFlunitSubclass((JSClass) parent) || isFlexUnit1Subclass((JSClass) parent))) {
      if (method.getName() != null && method.getName().startsWith("test")) return true;
    }

    if (method.getAttributeList() != null
        && method.getAttributeList().getAttributesByName(TEST_ATTRIBUTE).length > 0
        && method.getAttributeList().getAttributesByName(IGNORE_ATTRIBUTE).length == 0) {
      return true;
    }
    return false;
  }
  public boolean isTestMethod(JSFunction method) {
    if (!(method.getParent() instanceof JSClass)
        || method.getParent() instanceof XmlBackedJSClassImpl) return false;

    JSClass clazz = (JSClass) method.getParent();

    // FlexUnit 1: flexunit.framework.TestCase.getTestMethodNames()
    // Flunit: net.digitalprimates.fluint.tests.defaultFilterFunction()
    // FlexUnit 4: org.flexunit.runners.BlockFlexUnit4ClassRunner
    if (method.getName() == null) return false;

    if (flexUnit4Present && getCustomRunner(clazz) != null) return true;

    if (method.getAttributeList() == null) return false;
    if (method.getAttributeList().getAccessType() != JSAttributeList.AccessType.PUBLIC)
      return false;
    if (method.getKind() != JSFunction.FunctionKind.SIMPLE) return false;
    if (method.getAttributeList().hasModifier(JSAttributeList.ModifierType.STATIC)) return false;
    if (ValidateTypesUtil.hasRequiredParameters(method)) return false;

    if (isFlexUnit1Subclass(clazz)) {
      if (!method.getName().startsWith("test")) return false;
    } else if (isFlunitSubclass(clazz)) {
      if (!method.getName().startsWith("test")
          && method.getAttributeList().getAttributesByName(TEST_ATTRIBUTE).length == 0)
        return false;
    } else {
      if (!flexUnit4Present) return false;

      final JSType returnType = method.getReturnType();
      if (returnType != null && !(returnType instanceof JSVoidType)) return false;

      if (method.getAttributeList().getAttributesByName(IGNORE_ATTRIBUTE).length > 0) return false;
      if (method.getAttributeList().getAttributesByName(TEST_ATTRIBUTE).length == 0) return false;
    }
    return true;
  }