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


Java JSONCompareResult.passed方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:25,代码来源:ConsistencyChecker.java

示例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;
}
 
开发者ID:wesley-ramos,项目名称:spring-multitenancy,代码行数:13,代码来源:MongoPersistentEntityIndexCreator.java

示例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;
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:29,代码来源:JsonStringMatcher.java

示例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


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