`
JasonRight
  • 浏览: 72906 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

更改moreunit在workspace中查找Test类

    博客分类:
  • Java
J# 
阅读更多

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));
	}
}
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics