@@ -515,6 +515,70 @@ public static void assertNotEquals(String message, String expectedStr, String ac
515
515
}
516
516
}
517
517
518
+ /**
519
+ * Asserts that the JSONObject provided matches the expected JSONObject. If it isn't it throws an
520
+ * {@link AssertionError}.
521
+ *
522
+ * @param expected Expected JSONObject
523
+ * @param actual JSONObject to compare
524
+ * @param comparator Comparator
525
+ * @throws JSONException JSON parsing error
526
+ */
527
+ public static void assertEquals (JSONObject expected , JSONObject actual , JSONComparator comparator )
528
+ throws JSONException {
529
+ assertEquals ("" , expected , actual , comparator );
530
+ }
531
+
532
+ /**
533
+ * Asserts that the JSONObject provided matches the expected JSONObject. If it isn't it throws an
534
+ * {@link AssertionError}.
535
+ *
536
+ * @param message Error message to be displayed in case of assertion failure
537
+ * @param expected Expected JSONObject
538
+ * @param actual JSONObject to compare
539
+ * @param comparator Comparator
540
+ * @throws JSONException JSON parsing error
541
+ */
542
+ public static void assertEquals (String message , JSONObject expected , JSONObject actual , JSONComparator comparator )
543
+ throws JSONException {
544
+ JSONCompareResult result = JSONCompare .compareJSON (expected , actual , comparator );
545
+ if (result .failed ()) {
546
+ throw new AssertionError (getCombinedMessage (message , result .getMessage ()));
547
+ }
548
+ }
549
+
550
+ /**
551
+ * Asserts that the JSONObject provided does not match the expected JSONObject. If it is it throws an
552
+ * {@link AssertionError}.
553
+ *
554
+ * @param expected Expected JSONObject
555
+ * @param actual JSONObject to compare
556
+ * @param comparator Comparator
557
+ * @throws JSONException JSON parsing error
558
+ */
559
+ public static void assertNotEquals (JSONObject expected , JSONObject actual , JSONComparator comparator )
560
+ throws JSONException {
561
+ assertNotEquals ("" , expected , actual , comparator );
562
+ }
563
+
564
+ /**
565
+ * Asserts that the JSONObject provided does not match the expected JSONObject. If it is it throws an
566
+ * {@link AssertionError}.
567
+ *
568
+ * @param message Error message to be displayed in case of assertion failure
569
+ * @param expected Expected JSONObject
570
+ * @param actual JSONObject to compare
571
+ * @param comparator Comparator
572
+ * @throws JSONException JSON parsing error
573
+ */
574
+ public static void assertNotEquals (String message , JSONObject expected , JSONObject actual , JSONComparator comparator )
575
+ throws JSONException {
576
+ JSONCompareResult result = JSONCompare .compareJSON (expected , actual , comparator );
577
+ if (result .passed ()) {
578
+ throw new AssertionError (getCombinedMessage (message , result .getMessage ()));
579
+ }
580
+ }
581
+
518
582
/**
519
583
* Asserts that the JSONObject provided matches the expected JSONObject. If it isn't it throws an
520
584
* {@link AssertionError}.
0 commit comments