MCPcopy Create free account
hub / github.com/LianjiaTech/json-diff / diff7

Method diff7

src/test/java/com/ke/diff/diff/DiffTest.java:113–126  ·  view source on GitHub ↗

测试constrcutDefaultComparator方法

()

Source from the content-addressed store, hash-verified

111 * 测试constrcutDefaultComparator方法
112 */
113 @Test
114 public void diff7() {
115 String str1 = "{\"a\":null}";
116 String str2 = "{\"a\":[1,2,3]}";
117 JsonElement a = new JsonParser().parse(str1);
118 JsonElement b = new JsonParser().parse(str2);
119 List<String> specialPath = new ArrayList<>();
120 List<Result> diff1 = new Diff().withNoisePahList(null).withSpecialPath(specialPath)
121 .withObjectComparator(new SimpleObjectComparator()).diffElement(a, b);
122 List<Result> diff2 = new Diff().withNoisePahList(null).withSpecialPath(specialPath)
123 .withArrayComparator(new SimilarArrayComparator()).diffElement(a, b);
124 assertEquals(ResultConvertUtil.TYPE_MODIFY, diff1.get(0).getDiffType());
125 assertEquals(ResultConvertUtil.TYPE_MODIFY, diff2.get(0).getDiffType());
126 }
127}

Callers

nothing calls this directly

Calls 6

withObjectComparatorMethod · 0.80
withSpecialPathMethod · 0.80
withNoisePahListMethod · 0.80
withArrayComparatorMethod · 0.80
getDiffTypeMethod · 0.80
diffElementMethod · 0.65

Tested by

no test coverage detected