public class

JsonAssertions

extends Assert
java.lang.Object
   ↳ junit.framework.Assert
     ↳ com.atlassian.confluence.it.web.JsonAssertions

Class Overview

Assertions to compare JSON objects sensibly.

Summary

Public Constructors
JsonAssertions()
Public Methods
static JSONArray arr(Object... args)
Constructs a JSON array from the provided arguments.
static void assertJsonEquals(String message, JSONArray expected, JSONArray actual)
static void assertJsonEquals(String message, JSONObject expected, JSONObject actual)
static void assertJsonEquals(String message, Object expected, Object actual)
static void assertJsonHasProperties(String message, JSONObject expectedProperties, JSONObject actual)
static JSONObject obj(Object... args)
Constructs a JSON object from the provided arguments.
[Expand]
Inherited Methods
From class junit.framework.Assert
From class java.lang.Object

Public Constructors

public JsonAssertions ()

Public Methods

public static JSONArray arr (Object... args)

Constructs a JSON array from the provided arguments.

Throws
JSONException

public static void assertJsonEquals (String message, JSONArray expected, JSONArray actual)

Throws
JSONException

public static void assertJsonEquals (String message, JSONObject expected, JSONObject actual)

Throws
JSONException

public static void assertJsonEquals (String message, Object expected, Object actual)

Throws
JSONException

public static void assertJsonHasProperties (String message, JSONObject expectedProperties, JSONObject actual)

Throws
JSONException

public static JSONObject obj (Object... args)

Constructs a JSON object from the provided arguments. For example, call like this:

obj("a", "value", "b", "other-value")

to construct a JSON object like this:

{ "a": "value", "b": "other-value" }
Throws
JSONException