// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java
// public class CustomComparator extends DefaultComparator {
// 
//     private final Collection<Customization> customizations;
// 
//     public CustomComparator(JSONCompareMode mode,  Customization... customizations) {
//         super(mode);
//         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);
//             }
//         } else {
//             super.compareValues(prefix, expectedValue, actualValue, result);
//         }
//     }
// 
//     private Customization getCustomization(String path) {
//         for (Customization c : customizations)
//             if (c.appliesToPath(path))
//                 return c;
//         return null;
//     }
// }
// 
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/JSONComparator.java
// public interface JSONComparator {
// 
//     /**
//      * Compares two {@link JSONObject}s and returns the result of the comparison in a {@link JSONCompareResult} object.
//      *
//      * @param expected the expected JSON object
//      * @param actual   the actual JSON object
//      * @return the result of the comparison
//      * @throws JSONException JSON parsing error
//      */
//     JSONCompareResult compareJSON(JSONObject expected, JSONObject actual) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONArray}s and returns the result of the comparison in a {@link JSONCompareResult} object.
//      *
//      * @param expected the expected JSON array
//      * @param actual   the actual JSON array
//      * @return the result of the comparison
//      * @throws JSONException JSON parsing error
//      */
//     JSONCompareResult compareJSON(JSONArray expected, JSONArray actual) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONObject}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix   the path in the json where the comparison happens
//      * @param expected the expected JSON object
//      * @param actual   the actual JSON object
//      * @param result   stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareJSON(String prefix, JSONObject expected, JSONObject actual, JSONCompareResult result) throws JSONException;
// 
//     /**
//      * Compares two {@link Object}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix        the path in the json where the comparison happens
//      * @param expectedValue the expected value
//      * @param actualValue   the actual value
//      * @param result        stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONArray}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix   the path in the json where the comparison happens
//      * @param expected the expected JSON array
//      * @param actual   the actual JSON array
//      * @param result   stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareJSONArray(String prefix, JSONArray expected, JSONArray actual, JSONCompareResult result) throws JSONException;
// }


import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.skyscreamer.jsonassert.JSONCompareMode.LENIENT;
import static org.skyscreamer.jsonassert.JSONCompareMode.NON_EXTENSIBLE;
import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT;
import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT_ORDER;
import java.util.Arrays;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.comparator.CustomComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;
    @Test()
    public void testAssertNotEqualsJSONArray() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("[1,2,3]", actual, false);
        JSONAssert.assertNotEquals("[1,2,4]", actual, false);
        JSONAssert.assertNotEquals("[1,3,2]", actual, true);
        JSONAssert.assertNotEquals(new JSONArray(Arrays.asList(1, 2, 4)), actual, false);
        JSONAssert.assertNotEquals(new JSONArray(Arrays.asList(1, 3, 2)), actual, true);
    }
    
    @Test
    public void testAssertEqualsStringJSONArrayBooleanWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", "[1,2,3]", actual, false);
        performAssertEqualsTestForMessageVerification("[1,2,4]", actual, false);
        performAssertEqualsTestForMessageVerification("[1,3,2]", actual, true);
    }
    
    @Test
    public void testAssertEqualsStringJSONArrayCompareModeWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", "[1,2,3]", actual, LENIENT);
        performAssertEqualsTestForMessageVerification("[1,2,4]", actual, LENIENT);
        performAssertEqualsTestForMessageVerification("[1,3,2]", actual, STRICT);
    }

    @Test
    public void testAssertEqualsJSONArray2BooleanWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", new JSONArray(Arrays.asList(1, 2, 3)), actual, false);
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/CustomComparator.java
// public class CustomComparator extends DefaultComparator {
// 
//     private final Collection<Customization> customizations;
// 
//     public CustomComparator(JSONCompareMode mode,  Customization... customizations) {
//         super(mode);
//         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);
//             }
//         } else {
//             super.compareValues(prefix, expectedValue, actualValue, result);
//         }
//     }
// 
//     private Customization getCustomization(String path) {
//         for (Customization c : customizations)
//             if (c.appliesToPath(path))
//                 return c;
//         return null;
//     }
// }
// 
// Path: src/main/java/org/skyscreamer/jsonassert/comparator/JSONComparator.java
// public interface JSONComparator {
// 
//     /**
//      * Compares two {@link JSONObject}s and returns the result of the comparison in a {@link JSONCompareResult} object.
//      *
//      * @param expected the expected JSON object
//      * @param actual   the actual JSON object
//      * @return the result of the comparison
//      * @throws JSONException JSON parsing error
//      */
//     JSONCompareResult compareJSON(JSONObject expected, JSONObject actual) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONArray}s and returns the result of the comparison in a {@link JSONCompareResult} object.
//      *
//      * @param expected the expected JSON array
//      * @param actual   the actual JSON array
//      * @return the result of the comparison
//      * @throws JSONException JSON parsing error
//      */
//     JSONCompareResult compareJSON(JSONArray expected, JSONArray actual) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONObject}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix   the path in the json where the comparison happens
//      * @param expected the expected JSON object
//      * @param actual   the actual JSON object
//      * @param result   stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareJSON(String prefix, JSONObject expected, JSONObject actual, JSONCompareResult result) throws JSONException;
// 
//     /**
//      * Compares two {@link Object}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix        the path in the json where the comparison happens
//      * @param expectedValue the expected value
//      * @param actualValue   the actual value
//      * @param result        stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) throws JSONException;
// 
//     /**
//      * Compares two {@link JSONArray}s on the provided path represented by {@code prefix} and
//      * updates the result of the comparison in the {@code result} {@link JSONCompareResult} object.
//      *
//      * @param prefix   the path in the json where the comparison happens
//      * @param expected the expected JSON array
//      * @param actual   the actual JSON array
//      * @param result   stores the actual state of the comparison result
//      * @throws JSONException JSON parsing error
//      */
//     void compareJSONArray(String prefix, JSONArray expected, JSONArray actual, JSONCompareResult result) throws JSONException;
// }


// Path: src/test/java/org/skyscreamer/jsonassert/JSONAssertTest.java
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.skyscreamer.jsonassert.JSONCompareMode.LENIENT;
import static org.skyscreamer.jsonassert.JSONCompareMode.NON_EXTENSIBLE;
import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT;
import static org.skyscreamer.jsonassert.JSONCompareMode.STRICT_ORDER;
import java.util.Arrays;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.comparator.CustomComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;

    @Test()
    public void testAssertNotEqualsJSONArray() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("[1,2,3]", actual, false);
        JSONAssert.assertNotEquals("[1,2,4]", actual, false);
        JSONAssert.assertNotEquals("[1,3,2]", actual, true);
        JSONAssert.assertNotEquals(new JSONArray(Arrays.asList(1, 2, 4)), actual, false);
        JSONAssert.assertNotEquals(new JSONArray(Arrays.asList(1, 3, 2)), actual, true);
    }
    
    @Test
    public void testAssertEqualsStringJSONArrayBooleanWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", "[1,2,3]", actual, false);
        performAssertEqualsTestForMessageVerification("[1,2,4]", actual, false);
        performAssertEqualsTestForMessageVerification("[1,3,2]", actual, true);
    }
    
    @Test
    public void testAssertEqualsStringJSONArrayCompareModeWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", "[1,2,3]", actual, LENIENT);
        performAssertEqualsTestForMessageVerification("[1,2,4]", actual, LENIENT);
        performAssertEqualsTestForMessageVerification("[1,3,2]", actual, STRICT);
    }

    @Test
    public void testAssertEqualsJSONArray2BooleanWithMessage() throws JSONException {
        JSONArray actual = new JSONArray(Arrays.asList(1, 2, 3));
        JSONAssert.assertEquals("Message", new JSONArray(Arrays.asList(1, 2, 3)), actual, false);
        performAssertEqualsTestForMessageVerification(new JSONArray(Arrays.asList(1, 2, 4)), actual, false);