Package com._4point.testing.matchers.aem
Class PdfComparer
java.lang.Object
com._4point.testing.matchers.aem.PdfComparer
PdfComparer is used to compare to PDFs for visual results (sort of a "digital lightbox").
NOTE: Class is still under development - api and behaviour may change.
-
Constructor Summary
ConstructorsConstructorDescriptionPdfComparer(Path goldResultsDir, Path actualResultsDir) Constructs a PdfComparer -
Method Summary
Modifier and TypeMethodDescriptionorg.hamcrest.Matcher<byte[]> comparesEqual(String expectedResultFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesEqual(String expectedResultFile, String exclusionsFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesEqual(Path expectedResultFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesEqual(Path expectedResultFile, Path exclusionsFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesNotEqual(String expectedResultFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesNotEqual(String expectedResultFile, String exclusionsFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesNotEqual(Path expectedResultFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.org.hamcrest.Matcher<byte[]> comparesNotEqual(Path expectedResultFile, Path exclusionsFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file.
-
Constructor Details
-
PdfComparer
Constructs a PdfComparer- Parameters:
goldResultsDir- directory where the expected (gold) pdf result files will be. This cannot be null and the directory must already exist.actualResultsDir- directory where the actual results will be written along with diff comparison results. This directory will be created if it does not already exist. This parameter can be null if no actual lresults are to be retained.
-
-
Method Details
-
comparesEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. If the PDFs do not match, then the byte array is written to the actual results directory and a PDF of the differences is also written to the actual results directory.- Parameters:
expectedResultFile- path to expected result file.- Returns:
- the Matcher
-
comparesEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. If the PDFs do not match, then the byte array is written to the actual results directory and a PDF of the differences is also written to the actual results directory. This is a convenience function that converts the parameter to a Path and then calls comparesEqual(Path).- Parameters:
expectedResultFile- name of expected result file.- Returns:
- the Matcher
-
comparesNotEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. Nothing is written to the actual results directory regardless of the outcome of the match.- Parameters:
expectedResultFile- path to expected result file.- Returns:
- the Matcher
-
comparesNotEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. Nothing is written to the actual results directory regardless of the outcome of the match. This is a convenience function that converts the parameter to a Path and then calls comparesNotEqual(Path).- Parameters:
expectedResultFile- path to expected result file.- Returns:
- the Matcher
-
comparesEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. If the PDFs do not match, then the byte array is written to the actual results directory and a PDF of the differences is also written to the actual results directory.- Parameters:
expectedResultFile- path to expected result file.exclusionsFile- path to the exclusions file- Returns:
- the Matcher
-
comparesEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. If the PDFs do not match, then the byte array is written to the actual results directory and a PDF of the differences is also written to the actual results directory. This is a convenience function that converts the parameters to Path objects and then calls comparesEqual(Path, Path).- Parameters:
expectedResultFile- path to expected result file.exclusionsFile- path to the exclusions file- Returns:
- the Matcher
-
comparesNotEqual
Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. Nothing is written to the actual results directory regardless of the outcome of the match.- Parameters:
expectedResultFile- path to expected result file.exclusionsFile- path to the exclusions file- Returns:
- the Matcher
-
comparesNotEqual
public org.hamcrest.Matcher<byte[]> comparesNotEqual(String expectedResultFile, String exclusionsFile) Creates a matcher that compares a PDF in a byte array to a expected "gold" result file. If the expected "gold" result file path is relative, then it is relative to the "gold" directory. Nothing is written to the actual results directory regardless of the outcome of the match. This is a convenience function that converts the parameters to Path objects and then calls comparesNotEqual(Path, Path).- Parameters:
expectedResultFile- path to expected result file.exclusionsFile- path to the exclusions file- Returns:
- the Matcher
-