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


Java JSONCompareResult.getFieldFailures方法代码示例

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


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

示例1: logFailure

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
public static void logFailure(final String errorText, final JSONCompareResult jsonResult) {
    final List<FieldComparisonFailure> failureList = jsonResult.getFieldFailures();

    for (FieldComparisonFailure failure : failureList) {
        Log.warnFormatted(errorText, failure.getField(), failure.getExpected(), failure.getActual());
    }
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:8,代码来源:UaiJsonFieldFailureLogger.java

示例2: isListingMoreThanOneNotPresentAttribute

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isListingMoreThanOneNotPresentAttribute() {
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON("{id:1, age:1, aNumber:1}", "{name:\"JC\"}", STRICT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertTrue("all the missing fields should be present", failureList.size() > 1);
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:9,代码来源:UaiJSONComparatorErrorTest.java

示例3: isListingErrorWithWrongValueInAttribute

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isListingErrorWithWrongValueInAttribute() {
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON("{id:1}", "{id:2}", STRICT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertTrue("all the missing fields should be present", failureList.size() == 1);
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:9,代码来源:UaiJSONComparatorErrorTest.java

示例4: isComparingWithLine

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isComparingWithLine() {
    final String jsonWithoutLines = "{id:1,age:33}";
    final String jsonWithLines = "" +
            "{" +
            "   id:1," +
            "   age:33" +
            "}";
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON(jsonWithoutLines, jsonWithLines, STRICT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertTrue("Should not have any error", failureList.isEmpty());
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:15,代码来源:UaiJSONComparatorErrorTest.java

示例5: isComparingWithSuccess

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isComparingWithSuccess() {
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON("{id:1}", "{id:1}", STRICT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertTrue("Should not have any error", failureList.isEmpty());
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:9,代码来源:UaiJSONComparatorSuccessTest.java

示例6: isIgnoringWhenNotRequired

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isIgnoringWhenNotRequired() {
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON("{id:1}", "{id:1, age:33}", LENIENT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertTrue("Should not have any error", failureList.isEmpty());
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:9,代码来源:UaiJSONComparatorSuccessTest.java

示例7: test

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
    String s1 = "{ \"f1\":1, \"obj\":{ \"f2\":2}, \"arr\":[ {\"f4\":3 } ] }";
    String s2 = "{ \"f1\":2, \"obj\":{ \"f2\":3 }, \"arr\":[ {\"f4\":4 } ] }";
    JSONCompareResult result = JSONCompare.compareJSON(s1, s2,
            JSONCompareMode.STRICT);
    for (FieldComparisonFailure x : result.getFieldFailures()) {
        System.out.println(x.getField() + " " + x.getExpected() + " " + x.getActual());
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:11,代码来源:JsTest.java

示例8: isListingWhenAttributeIsNotPresent

import org.skyscreamer.jsonassert.JSONCompareResult; //导入方法依赖的package包/类
@Test
public void isListingWhenAttributeIsNotPresent() {
    final JSONCompareResult jsonCompareResult = UaiJSONCompareWrapper.compareJSON("{id:1}", "{}", STRICT_COMPARATOR);

    final List<FieldComparisonFailure> failureList = jsonCompareResult.getFieldFailures();

    assertFalse("should list a missing field as field failure", failureList.isEmpty());

    final FieldComparisonFailure failure = failureList.get(0);

    assertEquals("the id field should be listed", "id", failure.getField());
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:13,代码来源:UaiJSONComparatorErrorTest.java


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