当前位置: 首页>>代码示例>>Java>>正文


Java KoanMethodResult类代码示例

本文整理汇总了Java中com.sandwich.koan.result.KoanMethodResult的典型用法代码示例。如果您正苦于以下问题:Java KoanMethodResult类的具体用法?Java KoanMethodResult怎么用?Java KoanMethodResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KoanMethodResult类属于com.sandwich.koan.result包,在下文中一共展示了KoanMethodResult类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testToString

import com.sandwich.koan.result.KoanMethodResult; //导入依赖的package包/类
@Test
public void testToString() throws Exception {
	KoanResultBuilder builder = new KoanResultBuilder()
		.remainingCases(Arrays.asList(OneFailingKoan.class.getSimpleName()))
		.methodResult(new KoanMethodResult(KoanMethod.getInstance("", OneFailingKoan.class.getDeclaredMethods()[0]), "msg", "2"))
		.level("1")
		.numberPassing(3);
	KoanSuiteResult result = builder.build();
	String string = result.toString();
	assertTrue(string.contains("1"));
	assertTrue(string.contains("2"));
	assertTrue(string.contains("3"));
	assertTrue(string.contains(OneFailingKoan.class.getSimpleName()));
	assertTrue(string.contains(OneFailingKoan.class.getDeclaredMethods()[0].getName()));
	assertTrue(string.contains("msg"));
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:17,代码来源:KoansResultTest.java

示例2: runKoans

import com.sandwich.koan.result.KoanMethodResult; //导入依赖的package包/类
KoanSuiteResult runKoans() {
	List<String> passingSuites = new ArrayList<String>();
	List<String> failingSuites = new ArrayList<String>();
	String level = null;
	KoanMethodResult failure = null;
	DynamicClassLoader loader = KoanClassLoader.getInstance();
	Path pathToEnlightenment = getPathToEnlightenment();
	KoanSuiteCompilationListener compilationListener = new KoanSuiteCompilationListener();
	int successfull = 0;
	for (Entry<String, Map<String, Map<String, KoanElementAttributes>>> packages : pathToEnlightenment) {
		for (Entry<String, Map<String, KoanElementAttributes>> e : packages.getValue().entrySet()) {
			String name = e.getKey().substring(e.getKey().lastIndexOf('.')+1);
			if(failure == null){
				Object suite = safelyConstructSuite(loader, compilationListener, e);
				final List<KoanElementAttributes> attributes = new ArrayList<KoanElementAttributes>(e.getValue().values());
				final List<KoanMethod> methods = mergeJavaFilesMethodsAndThoseInXml(suite, attributes, pathToEnlightenment.getOnlyMethodNameToRun());
				Collections.sort(methods, new KoanComparator());
				for (final KoanMethod koan : methods) {
					KoanMethodResult result = KoanMethodRunner.run(suite, koan);
					if(KoanMethodResult.PASSED != result){
						// Test failed!
						failure = result;
						failingSuites.add(name);
						break;
					}else{
						successfull++;
					}
				}
				if (failure == null) {
					passingSuites.add(name);
				}
				level = packages.getKey();
			}else{
				failingSuites.add(name);
			}
		}
	}
	return new KoanResultBuilder()
			.level(level)
			.numberPassing(successfull)
			.totalNumberOfKoanMethods(pathToEnlightenment.getTotalNumberOfKoans())
			.methodResult(failure).passingCases(passingSuites)
			.remainingCases(failingSuites).build();
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:45,代码来源:RunKoans.java


注:本文中的com.sandwich.koan.result.KoanMethodResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。