moreunit 可以从一个类的editor中跳转到测试类(ctrl+J).
如果测试类是在另外一个project中, 需要修改project的properties . 因为项目中的其它人员没有使用moreunit插件,所以不想check in 这个配置文件到snv中。
修改moreunit的方法org.moreunit.util.TestCaseDiviner.findPotentialTargets,增加从workspace这个scope中查找
for (String element : prefixes)
{
//this.matches.addAll(SearchTools.searchFor(getSearchTerm(this.source
// , element, true), this.compilationUnit));
Set<IType> origionalPrefixMatch = SearchTools.searchFor(getSearchTerm(this.source, element, true), this.compilationUnit, getSearchScope());
this.matches.addAll(origionalPrefixMatch);
if(origionalPrefixMatch.isEmpty())//add search in workspace
{
IJavaSearchScope workSpaceScop = SearchEngine.createWorkspaceScope();
this.matches.addAll(SearchTools.searchFor(getSearchTerm(this.source, element, true), this.compilationUnit, workSpaceScop));
}
}
String[] suffixes = this.preferences.getSuffixes(getJavaProject());
for (String element : suffixes)
{
// this.matches.addAll(SearchTools.searchFor(getSearchTerm(this.source
// , element, false), this.compilationUnit));
Set<IType> origionalPostfixMatch = SearchTools.searchFor(getSearchTerm(this.source, element, false), this.compilationUnit, getSearchScope());
this.matches.addAll(origionalPostfixMatch);
if(origionalPostfixMatch.isEmpty())//add search in workspace
{
IJavaSearchScope workSpaceScop = SearchEngine.createWorkspaceScope();
this.matches.addAll(SearchTools.searchFor(getSearchTerm(this.source, element, false), this.compilationUnit, workSpaceScop));
}
}