Package org.skyscreamer.jsonassert.comparator

Examples of org.skyscreamer.jsonassert.comparator.DefaultComparator


  /*
   * Following tests contain copies of code quoted in ArrayValueMatcher JavaDoc and are included to verify that the exact code documented works as expected.
   */
  @Test
  public void verifyIdAttributeOfFirstArrayElementMatches() throws JSONException {
    JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
    Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 0));
    JSONAssert.assertEquals("{a:[{id:1}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here


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

    JSONAssert.assertEquals("{a:{id:1}}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
 
  @Test
  public void verifyTypeAttributeOfSecondAndThirdElementMatchesRow() throws JSONException {
    JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
    Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator, 1, 2));
    JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

    JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
 
  @Test
  public void verifyTypeAttributeOfEveryArrayElementMatchesRow() throws JSONException {
     JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator));
     JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

     JSONAssert.assertEquals("{a:[{type:row}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
 
  @Test
  public void verifyBackgroundAttributesOfEveryArrayElementAlternateBetweenWhiteAndGrey() throws JSONException {
     JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
     Customization customization = new Customization("a", new ArrayValueMatcher<Object>(comparator));
     JSONAssert.assertEquals("{a:[{background:white},{background:grey}]}", ARRAY_OF_JSONOBJECTS, new CustomComparator(JSONCompareMode.LENIENT, customization));
  }
View Full Code Here

public final class JSONCompare {
    private JSONCompare() {
    }

    private static JSONComparator getComparatorForMode(JSONCompareMode mode) {
        return new DefaultComparator(mode);
    }
View Full Code Here

TOP

Related Classes of org.skyscreamer.jsonassert.comparator.DefaultComparator

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.