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


Java Description.appendValueList方法代码示例

本文整理汇总了Java中org.hamcrest.Description.appendValueList方法的典型用法代码示例。如果您正苦于以下问题:Java Description.appendValueList方法的具体用法?Java Description.appendValueList怎么用?Java Description.appendValueList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hamcrest.Description的用法示例。


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

示例1: matchesQueryParameter

import org.hamcrest.Description; //导入方法依赖的package包/类
private boolean matchesQueryParameter(RecordedRequest item, Description mismatchDescription) {
    String path = item.getPath();
    boolean hasQuery = path.indexOf("?") > 0;
    if (!hasQuery) {
        mismatchDescription.appendText(" query was empty");
        return false;
    }

    String query = path.substring(path.indexOf("?") + 1, path.length());
    String[] parameters = query.split("&");
    for (String p : parameters) {
        if (p.equals(String.format("%s=%s", first, second))) {
            return true;
        }
    }
    mismatchDescription.appendValueList("Query parameters were {", ", ", "}.", parameters);
    return false;
}
 
开发者ID:auth0,项目名称:Guardian.java,代码行数:19,代码来源:RecordedRequestMatcher.java

示例2: describeTo

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
public void describeTo(Description description) {

    if (!expected.isEmpty()) {
        description.appendValueList("Expected Bucket content [{", "},{", "}].", expected.entrySet());
    }
    if (!without.isEmpty()) {
        description.appendValueList("Expected Bucket to not include [", ",", "].", without);
    }

}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:12,代码来源:IsTupleMatcher.java

示例3: matchesSafely

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(String item, Description mismatchDescription) {
    ObjectMapper objectMapper = new ObjectMapper();
    JsonNode jsonNode = getJsonNode(item, objectMapper);

    List<String> validationMessages = schema.validate(jsonNode)
            .stream()
            .map(ValidationMessage::getMessage)
            .collect(toList());

    mismatchDescription.appendValueList("schema validation failed with the following errors: \n - ", "\n - ", "", validationMessages);

    return validationMessages.isEmpty();
}
 
开发者ID:tyro,项目名称:pact-spring-mvc,代码行数:15,代码来源:JsonSchemaMatcher.java

示例4: matchesSafely

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(RastDiff diff, Description mismatchDescription) {
	List<RelationshipQuery> falseNegatives = new ArrayList<>();
	Set<Relationship> truePositives = new HashSet<>();
	Set<Relationship> falsePositives = new HashSet<>(diff.getRelationships());
	for (RelationshipQuery query : queries) {
		Optional<Relationship> optional = query.find(diff);
		if (optional.isPresent()) {
			truePositives.add(optional.get());
			falsePositives.remove(optional.get());
		} else {
			falseNegatives.add(query);
		}
	}
	int tp = truePositives.size();
	int fp = computeFp ? falsePositives.size() : 0;
	int fn = falseNegatives.size();
	if (fn != 0 || fp != 0) {
		if (computeFp) {
			mismatchDescription.appendText(String.format("%d true positives, %d false positives, %d false negatives", tp, fp, fn));
		} else {
			mismatchDescription.appendText(String.format("%d true positives, %d false negatives", tp, fn));
		}
		if (!falseNegatives.isEmpty()) {
			mismatchDescription.appendValueList("\nFalse negatives:\n", "\n", "", falseNegatives);
		}
		if (!falsePositives.isEmpty()) {
			mismatchDescription.appendValueList("\nFalse positives:\n", "\n", "", falsePositives);
		}
		return false;
	}
	return true;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:34,代码来源:RastDiffMatchers.java


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