Package org.skyscreamer.jsonassert

Examples of org.skyscreamer.jsonassert.Customization


  private static final String CONSTANT_URI_REGEX_EXPECTED_JSON = "{d:{results:[{__metadata:{uri:X}}]}}";

  private void doTest(String jsonPath, String regex, String expectedJSON,
      String actualJSON) throws JSONException {
    JSONAssert.assertEquals(expectedJSON, actualJSON, new CustomComparator(
        JSONCompareMode.STRICT_ORDER, new Customization(jsonPath,
            new RegularExpressionValueMatcher<Object>(regex))));
  }
View Full Code Here


    }

    @Test
    public void dynamicRegexMatchesStringAttributeInsideArrayWithNoArgConstructor() throws JSONException {
    JSONAssert.assertEquals("{d:{results:[{__metadata:{uri:\"http://localhost:80/Person\\\\('\\\\d+'\\\\)\"}}]}}", JSON_STRING_WITH_ARRAY, new CustomComparator(
        JSONCompareMode.STRICT_ORDER, new Customization(ARRAY_ELEMENT_PREFIX,
            new RegularExpressionValueMatcher<Object>())));
    }
View Full Code Here

        this.customizations = Arrays.asList(customizations);
    }

    @Override
    public void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) throws JSONException {
        Customization customization = getCustomization(prefix);
        if (customization != null) {
            try {
              if (!customization.matches(prefix, actualValue, expectedValue, result)) {
                    result.fail(prefix, expectedValue, actualValue);
                }
            }
            catch (ValueMatcherException e) {
                result.fail(prefix, e);
View Full Code Here

TOP

Related Classes of org.skyscreamer.jsonassert.Customization

Copyright © 2018 www.massapicom. 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.