Class GraniteAssert
- java.lang.Object
-
- com.adobe.cq.testing.junit.assertion.GraniteAssert
-
public class GraniteAssert extends Object
Assertion utility methods for Granite integration testing.
-
-
Constructor Summary
Constructors Constructor Description GraniteAssert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertIsAgentEnabled(CQClient client, String agentPath)Checks if an replication agent is enabled.static voidassertJsonEquals(String jsonString1, String jsonString2)Compares two json strings for equality in terms of structure and data.static voidassertJsonEquals(String jsonString1, String jsonString2, List<String> ignoreProperties)Compares two json strings for equality in terms of structure and data.static voidassertJsonEquals(String jsonStringExpected, String jsonStringActual, List<String> ignoreProperties, List<String> ignoreNodes)Compares two json strings for equality in terms of structure and data.static voidassertJsonEquals(String jsonStringExpected, String jsonStringActual, List<String> ignoreProperties, List<String> ignoreNodes, boolean ignoreOrderOfProperties)Compares two json strings for equality in terms of structure and data.static voidassertRegExFind(String toValidate, String pattern)static voidassertRegExFind(String message, String toValidate, String pattern)static voidassertRegExFind(String message, String toValidate, Pattern pattern)static voidassertRegExFind(String toValidate, Pattern pattern)static voidassertRegExMatch(String toValidate, String pattern)static voidassertRegExMatch(String message, String toValidate, String pattern)static voidassertRegExMatch(String message, String toValidate, Pattern pattern)static voidassertRegExMatch(String toValidate, Pattern pattern)static voidassertRegExNoFind(String message, String toValidate, Pattern pattern)static voidassertRegExNoMatch(String message, String toValidate, Pattern pattern)static voidassertStatusCode(String message, org.apache.http.HttpResponse httpResponse, int statusCode)static voidassertStatusCode(String message, org.apache.http.HttpResponse httpResponse, int[] statusCodes)static voidassertStatusCode(org.apache.http.HttpResponse httpResponse, int statusCode)static voidassertStatusCode(org.apache.http.HttpResponse httpResponse, int[] statusCodes)
-
-
-
Method Detail
-
assertRegExMatch
public static void assertRegExMatch(String message, String toValidate, String pattern)
-
assertRegExMatch
public static void assertRegExMatch(String message, String toValidate, Pattern pattern)
-
assertRegExNoMatch
public static void assertRegExNoMatch(String message, String toValidate, Pattern pattern)
-
assertRegExFind
public static void assertRegExFind(String message, String toValidate, String pattern)
-
assertRegExFind
public static void assertRegExFind(String message, String toValidate, Pattern pattern)
-
assertRegExNoFind
public static void assertRegExNoFind(String message, String toValidate, Pattern pattern)
-
assertStatusCode
public static void assertStatusCode(org.apache.http.HttpResponse httpResponse, int statusCode)
-
assertStatusCode
public static void assertStatusCode(String message, org.apache.http.HttpResponse httpResponse, int statusCode)
-
assertStatusCode
public static void assertStatusCode(org.apache.http.HttpResponse httpResponse, int[] statusCodes)
-
assertStatusCode
public static void assertStatusCode(String message, org.apache.http.HttpResponse httpResponse, int[] statusCodes)
-
assertJsonEquals
public static void assertJsonEquals(String jsonString1, String jsonString2, List<String> ignoreProperties)
Compares two json strings for equality in terms of structure and data.There are some properties, like the lastModified property, that make it hard to compare against a reference. In this case you can feed in a list of of such properties, and they are ignored during comparison.
- Parameters:
jsonString1- expectedjsonString2- actualignoreProperties- properties to be ignored
-
assertJsonEquals
public static void assertJsonEquals(String jsonStringExpected, String jsonStringActual, List<String> ignoreProperties, List<String> ignoreNodes)
Compares two json strings for equality in terms of structure and data. By default order of properties will be not taken in account.There are some properties, like the lastModified property, that make it hard to compare against a reference. In this case you can feed in a list of of such properties, and they are ignored during comparison.
- Parameters:
jsonStringExpected- expectedjsonStringActual- actualignoreProperties- properties to be ignoredignoreNodes- nodes to be ignored
-
assertJsonEquals
public static void assertJsonEquals(String jsonStringExpected, String jsonStringActual, List<String> ignoreProperties, List<String> ignoreNodes, boolean ignoreOrderOfProperties)
Compares two json strings for equality in terms of structure and data.There are some properties, like the lastModified property, that make it hard to compare against a reference. In this case you can feed in a list of of such properties, and they are ignored during comparison.
- Parameters:
jsonStringExpected- expectedjsonStringActual- actualignoreProperties- properties to be ignoredignoreNodes- nodes to be ignoredignoreOrderOfProperties- ignore the order of properties
-
assertJsonEquals
public static void assertJsonEquals(String jsonString1, String jsonString2)
Compares two json strings for equality in terms of structure and data.- Parameters:
jsonString1- first stringjsonString2- second string
-
-