Package com.adobe.cq.testing.util
Class TestUtil
- java.lang.Object
-
- com.adobe.cq.testing.util.TestUtil
-
public class TestUtil extends Object
Some helper utilities for testing.
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.lang3.time.FastDateFormatISO_DATETIME_TIME_ZONE_FORMATThe formatter for ISO8601 date time including milliseconds and time zone.
-
Constructor Summary
Constructors Constructor Description TestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanbinaryCompare(InputStream i1, InputStream i2)Makes a MD5 compare of two input streams.static StringgetMD5Checksum(InputStream stream)Calculates the MD5 checksum for a input stream.static DateparseJsonDateString(String dateString)Parses a string representing a date, as it is returned when requesting a node using .jsonstatic StringreplaceSpecialCharsForRegexp(String regexp)Escapes special characters in the string to avoid breaking a regexp
-
-
-
Method Detail
-
parseJsonDateString
public static Date parseJsonDateString(String dateString) throws org.apache.sling.testing.clients.ClientException
Parses a string representing a date, as it is returned when requesting a node using .json- Parameters:
dateString- string representing a date- Returns:
- the date object
- Throws:
org.apache.sling.testing.clients.ClientException- if the string cannot be parsed
-
getMD5Checksum
public static String getMD5Checksum(InputStream stream)
Calculates the MD5 checksum for a input stream. The input stream gets closed after checksum has been calculated.- Parameters:
stream- the input stream- Returns:
- the MD5 Checksum string
-
binaryCompare
public static boolean binaryCompare(InputStream i1, InputStream i2)
Makes a MD5 compare of two input streams. the input streams are closed after md5 has been calculated.- Parameters:
i1- First Input Streami2- Second Input Stream- Returns:
- true if binaries are the same otherwise false
-
-