當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。