Package org.eclipse.jdt.internal.junit.launcher

Examples of org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder


  }

  public Set getTests(IPackageFragment pack) {
    try {
      HashSet result = new HashSet();
      new JUnit4TestFinder().findTestsInContainer(pack, result, null);
      return result;
    } catch (CoreException e) {
      Activator.log(e);
      return Collections.EMPTY_SET;
    }
View Full Code Here


        if(element != null && element.getElementType() == IJavaElement.METHOD){
          method = (IMethod)element;
        }
      }

      JUnit4TestFinder finder = new JUnit4TestFinder();
      IType type = src.getTypes()[0];
      if (!finder.isTest(type)){
        src = JUnitUtils.findTest(javaProject, type);
        if (src == null){
          println(Services.getMessage("junit.testing.test.not.found"));
          return null;
        }
View Full Code Here

    String file = commandLine.getValue(Options.FILE_OPTION);
    int offset = getOffset(commandLine);

    IProject project = ProjectUtils.getProject(projectName);
    IJavaProject javaProject = JavaUtils.getJavaProject(project);
    JUnit4TestFinder finder = new JUnit4TestFinder();

    ICompilationUnit src = JavaUtils.getCompilationUnit(javaProject, file);
    ICompilationUnit result = null;
    if (finder.isTest(src.getTypes()[0])){
      result = JUnitUtils.findClass(javaProject, src.getTypes()[0]);
      if (result == null){
        return Services.getMessage("junit.testing.class.not.found");
      }
    } else {
      result = JUnitUtils.findTest(javaProject, src.getTypes()[0]);
      if (result == null){
        return Services.getMessage("junit.testing.test.not.found");
      }
    }

    IType resultType = result.getTypes()[0];
    String name = resultType.getElementName();
    ISourceReference ref = resultType;
    ISourceRange docRange = resultType.getJavadocRange();

    IJavaElement element = src.getElementAt(offset);
    if(element != null && element.getElementType() == IJavaElement.METHOD){
      IMethod method = null;
      if (finder.isTest(src.getTypes()[0])){
        method = JUnitUtils.findClassMethod(result, (IMethod)element);
      }else{
        method = JUnitUtils.findTestMethod(result, (IMethod)element);
      }
      if (method != null){
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder

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.