예제 #1
0
  @Test
  public void testDiffSameFile() throws Exception {
    JSONObject json = new JSONObject(readFile("src/org/jsonunit/test/test_normal.json"));
    JSONObject json_same = new JSONObject(readFile("src/org/jsonunit/test/test_normal.json"));

    JSONDiff diff = new JSONDiff(json, json_same);

    assertTrue(diff.seam());
  }
예제 #2
0
  @Test
  public void testDiffSimilarFile() throws Exception {
    JSONObject json = new JSONObject(readFile("src/org/jsonunit/test/test_normal.json"));
    JSONObject json_similar =
        new JSONObject(readFile("src/org/jsonunit/test/test_normal_similar.json"));

    JSONDiff diff = new JSONDiff(json, json_similar);

    assertFalse(diff.seam());
    assertTrue(diff.similar());
  }
예제 #3
0
  @Test
  public void testGetDiffPath() throws Exception {
    JSONObject json = new JSONObject(readFile("src/org/jsonunit/test/test_normal.json"));
    JSONObject json_similar =
        new JSONObject(readFile("src/org/jsonunit/test/test_normal_similar.json"));

    JSONDiff diff = new JSONDiff(json, json_similar);

    assertFalse(diff.seam());
    String[] ps = diff.getDiffPath();
    assertEquals("/Image/Width", ps[0]);
    assertEquals("/Image/Width", ps[1]);
  }