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){