private static boolean haveGroupsDependency(ICompilationUnit[] units) {
    List resources = new ArrayList();
    for (int i = 0; i < units.length; i++) {
      try {
        resources.add(units[i].getCorrespondingResource());
      } catch (JavaModelException jmex) {;
      }
    }
    IResource[] scopeResources = (IResource[]) resources.toArray(new IResource[resources.size()]);
    ISearchQuery query =
        new FileSearchQuery(
            "@Test\\(.*\\s*dependsOnGroups\\s*=.*",
            true /*regexp*/,
            true /*casesensitive*/,
            FileTextSearchScope.newSearchScope(scopeResources, new String[] {"*.java"}, false));
    query.run(new NullProgressMonitor());
    FileSearchResult result = (FileSearchResult) query.getSearchResult();
    Object[] elements = result.getElements();

    return elements != null && elements.length > 0;
  }
  /**
   * Uses the Eclipse search support to look for @Test annotation and decide if the compliance level
   * should be set to JDK or JAVADOC.
   */
  private static String getQuickComplianceLevel(IType[] types) {
    List resources = new ArrayList();
    for (int i = 0; i < types.length; i++) {
      try {
        resources.add(types[i].getCompilationUnit().getCorrespondingResource());
      } catch (JavaModelException jmex) {;
      }
    }
    IResource[] scopeResources = (IResource[]) resources.toArray(new IResource[resources.size()]);
    ISearchQuery query =
        new FileSearchQuery(
            "@(Test|Before|After|Factory)(\\(.+)?",
            true /*regexp*/,
            true /*casesensitive*/,
            FileTextSearchScope.newSearchScope(scopeResources, getJavaLikeExtensions(), false));
    query.run(new NullProgressMonitor());
    FileSearchResult result = (FileSearchResult) query.getSearchResult();
    Object[] elements = result.getElements();

    return elements != null && elements.length > 0
        ? TestNG.JDK_ANNOTATION_TYPE
        : TestNG.JAVADOC_ANNOTATION_TYPE;
  }