Examples of JSONComparator


Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

     JSONAssert.assertEquals("{a:[{background:white},{background:grey}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
 
  @Test
  public void verifyEveryElementOfArrayIsJSONArrayOfLength3() throws JSONException {
     JSONComparator comparator = new ArraySizeComparator(JSONCompareMode.STRICT_ORDER);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 0, 2));
     JSONAssert.assertEquals("{a:[[3]]}", ARRAY_OF_JSONARRAYS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

  }
 
  @Test
  public void verifySecondElementOfArrayIsJSONArrayWhoseFirstElementIs9() throws JSONException {
     Customization innerCustomization = new Customization("a[1]", new ArrayValueMatcher<Object>(comparator, 0));
     JSONComparator comparator = new CustomComparator(JSONCompareMode.LENIENT, innerCustomization);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 1));
     JSONAssert.assertEquals("{a:[[9]]}", ARRAY_OF_JSONARRAYS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

  }
 
  @Test
  public void verifySecondElementOfArrayIsJSONArrayWhoseFirstElementIs9WithSimpliedExpectedString() throws JSONException {
     Customization innerCustomization = new Customization("a[1]", new ArrayValueMatcher<Object>(comparator, 0));
     JSONComparator comparator = new CustomComparator(JSONCompareMode.LENIENT, innerCustomization);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 1));
     JSONAssert.assertEquals("{a:[9]}", ARRAY_OF_JSONARRAYS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

  }
 
  @Test
  public void verifySecondElementOfArrayIsJSONArrayWhoseFirstElementIs9WithEvenMoreSimpliedExpectedString() throws JSONException {
     Customization innerCustomization = new Customization("a[1]", new ArrayValueMatcher<Object>(comparator, 0));
     JSONComparator comparator = new CustomComparator(JSONCompareMode.LENIENT, innerCustomization);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 1));
     JSONAssert.assertEquals("{a:9}", ARRAY_OF_JSONARRAYS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

        }
    };

    @Test
    public void whenPathMatchesInCustomizationThenCallCustomMatcher() throws JSONException {
        JSONComparator jsonCmp = new CustomComparator(JSONCompareMode.STRICT, new Customization("first", comparator));
        JSONCompareResult result = compareJSON(expected, actual, jsonCmp);
        assertTrue(result.getMessage(),  result.passed());
        assertEquals(1, comparatorCallCount);
    }
View Full Code Here

Examples of org.skyscreamer.jsonassert.comparator.JSONComparator

        assertEquals(1, comparatorCallCount);
    }

    @Test
    public void whenDeepPathMatchesCallCustomMatcher() throws JSONException {
        JSONComparator jsonCmp = new CustomComparator(JSONCompareMode.STRICT, new Customization("outer.inner.value", comparator));
        JSONCompareResult result = compareJSON(deepExpected, deepActual, jsonCmp);
        assertTrue(result.getMessage(), result.passed());
        assertEquals(1, comparatorCallCount);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.