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 Details

    • GraniteAssert

      public GraniteAssert()
  • Method Details

    • assertRegExMatch

      public static void assertRegExMatch(String toValidate, String pattern)
    • assertRegExMatch

      public static void assertRegExMatch(String message, String toValidate, String pattern)
    • assertRegExMatch

      public static void assertRegExMatch(String toValidate, Pattern 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 toValidate, String pattern)
    • assertRegExFind

      public static void assertRegExFind(String message, String toValidate, String pattern)
    • assertRegExFind

      public static void assertRegExFind(String toValidate, Pattern 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 - expected
      jsonString2 - actual
      ignoreProperties - 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 - expected
      jsonStringActual - actual
      ignoreProperties - properties to be ignored
      ignoreNodes - 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 - expected
      jsonStringActual - actual
      ignoreProperties - properties to be ignored
      ignoreNodes - nodes to be ignored
      ignoreOrderOfProperties - 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 string
      jsonString2 - second string
    • assertIsAgentEnabled

      public static void assertIsAgentEnabled(CQClient client, String agentPath)
      Checks if an replication agent is enabled. Asserts if its not the case.
      Parameters:
      client - The client used for verification
      agentPath - The path to the agent