Exemple #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());
  }
Exemple #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());
  }
Exemple #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]);
  }