本文整理汇总了Java中org.skyscreamer.jsonassert.JSONCompareResult.passed方法的典型用法代码示例。如果您正苦于以下问题:Java JSONCompareResult.passed方法的具体用法?Java JSONCompareResult.passed怎么用?Java JSONCompareResult.passed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.skyscreamer.jsonassert.JSONCompareResult
的用法示例。
在下文中一共展示了JSONCompareResult.passed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logInconsistencyUsingJSONCompare
import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
private void logInconsistencyUsingJSONCompare(final String parentThreadName, final String legacyJson, final String lightblueJson, final MethodCallStringifier callToLogInCaseOfInconsistency) {
try {
Timer t = new Timer("ConsistencyCheck (JSONCompare)");
JSONCompareResult result = JSONCompare.compareJSON(legacyJson, lightblueJson, JSONCompareMode.NON_EXTENSIBLE);
long jiffConsistencyCheckTook = t.complete();
if (inconsistencyLog.isDebugEnabled()) {
inconsistencyLog.debug(String.format("[%s] JSONCompare consistency check took: %dms", parentThreadName, jiffConsistencyCheckTook));
inconsistencyLog.debug(String.format("[%s] JSONCompare consistency check passed: true", parentThreadName));
}
if (result.passed()) {
inconsistencyLog.error(String.format("[%s] Jiff consistency check found an inconsistency but JSONCompare didn't! Happened in %s", parentThreadName, callToLogInCaseOfInconsistency.toString()));
return;
}
// log nice diff
logInconsistency(parentThreadName, callToLogInCaseOfInconsistency.toString(), legacyJson, lightblueJson, result.getMessage().replaceAll("\n", ","));
} catch (Exception e) {
inconsistencyLog.error("JSONCompare consistency check failed for " + callToLogInCaseOfInconsistency, e);
}
}
示例2: isDifferenceInDefinition
import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
private boolean isDifferenceInDefinition(String currentIndex, String definition){
try {
JSONCompareResult result = JSONCompare.compareJSON(definition, currentIndex, JSONCompareMode.STRICT);
return result.passed();
} catch (JSONException ex){
logger.error("Failed while checking indexes", ex);
}
return false;
}
示例3: compareForNull
import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
private JSONCompareResult compareForNull(CharSequence expectedJson) {
JSONCompareResult result = new JSONCompareResult();
result.passed();
if (expectedJson != null) {
result.fail("Expected null JSON");
}
return result;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:JsonContentAssert.java
示例4: matches
import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
public boolean matches(final HttpRequest context, String matched) {
boolean result = false;
JSONCompareResult jsonCompareResult;
try {
if (Strings.isNullOrEmpty(matcher)) {
result = true;
} else {
JSONCompareMode jsonCompareMode = JSONCompareMode.LENIENT;
if (matchType == MatchType.STRICT) {
jsonCompareMode = JSONCompareMode.STRICT;
}
jsonCompareResult = compareJSON(matcher, matched, jsonCompareMode);
if (jsonCompareResult.passed()) {
result = true;
}
if (!result) {
mockServerLogger.trace(context, "Failed to perform JSON match \"{}\" with \"{}\" because {}", matched, this.matcher, jsonCompareResult.getMessage());
}
}
} catch (Exception e) {
mockServerLogger.trace(context, "Failed to perform JSON match \"{}\" with \"{}\" because {}", matched, this.matcher, e.getMessage());
}
return not != result;
}
示例5: assertNotPassed
import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
private JsonContentAssert assertNotPassed(JSONCompareResult result) {
if (result.passed()) {
throw new AssertionError("JSON Comparison failure: " + result.getMessage());
}
return this;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:JsonContentAssert.java