MCPcopy Index your code
hub / github.com/LianjiaTech/json-diff / main

Method main

src/test/java/cases/ShowCase.java:20–41  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

18
19public class ShowCase {
20 public static void main(String[] args) {
21 List<Pair<String, String>> caseList = getCaseList();
22 for (int index = 0; index < caseList.size(); index++) {
23 List<String> noiseList = Lists.newArrayList();
24 List<String> noiseList1 = Lists.newArrayList("msg", "cost");
25 List<String> noiseList2 = Lists.newArrayList("msg", "cost", "a.b");
26 noiseList.addAll(noiseList1);
27 noiseList.addAll(noiseList2);
28 System.out.println("*************************");
29 System.out.println("case[" + index + "] result is ");
30 LinkedList<String> specialPath = new LinkedList<>();
31 //第一种diff方法 详细使用方法见README.md文件
32 List<Result> diff1 = new Diff().diff(caseList.get(index).getLeft(), caseList.get(index).getRight());
33 //第二种diff方法 详细使用方法见README.md文件
34 List<Result> diff2 = new Diff().withNoisePahList(noiseList).withSpecialPath(specialPath).withAlgorithmEnum(AlgorithmEnum.DEFAULT).diff(caseList.get(index).getLeft(), caseList.get(index).getRight());
35 System.out.println("left is : " + caseList.get(index).getLeft());
36 System.out.println("right is : " + caseList.get(index).getRight());
37 System.out.println("result is : " + new Gson().toJson(diff1));
38 System.out.println("result is : " + new Gson().toJson(diff2));
39
40 }
41 }
42
43
44 private static List<Pair<String, String>> getCaseList() {

Callers

nothing calls this directly

Calls 7

getCaseListMethod · 0.95
withAlgorithmEnumMethod · 0.80
withSpecialPathMethod · 0.80
withNoisePahListMethod · 0.80
diffMethod · 0.65
getLeftMethod · 0.45
getRightMethod · 0.45

Tested by

no test coverage detected