Class DualComparer

Object
DualComparer

public class DualComparer extends Object
Allows for comparison of objects that exist on different test loaders
Author:
Owen Feehan
  • Constructor Details

    • DualComparer

      public DualComparer(TestLoader loader1, TestLoader loader2)
      Creates a new DualComparer instance.
      Parameters:
      loader1 - the first TestLoader
      loader2 - the second TestLoader
  • Method Details

    • compareTwoImages

      public boolean compareTwoImages(String path) throws FileNotFoundException
      Compare two images that have an identical path, but in two different test loaders.
      Parameters:
      path - relative-path (compared to root of both loaders) of files to compare.
      Returns:
      true when the images are equal (every pixel is identical, and data-types are the same).
      Throws:
      FileNotFoundException - if one or both of the files cannot be found.
    • compareTwoImages

      public boolean compareTwoImages(String path1, String path2, boolean ignoreResolutionDifferences) throws FileNotFoundException
      Compare two images with different paths, but in two different test loaders.
      Parameters:
      path1 - relative-path (compared to root of first loader) of first image.
      path2 - relative-path (compared to root of second loader) of second image.
      ignoreResolutionDifferences - if true any differences in image-resolution are not considered.
      Returns:
      true when the images are equal (every pixel is identical, and data-types are the same), false otherwise.
      Throws:
      FileNotFoundException - if one or both of the files cannot be found.
    • compareTwoXmlDocuments

      public boolean compareTwoXmlDocuments(String path)
      Compare two XML documents. They are compared by their DOM trees, but they need to be identical for equality.
      Parameters:
      path - relative-path (compared to root of both loaders) of files to compare
      Returns:
      true when the xml-documents are equal, false otherwise.
    • compareTwoCsvFiles

      public boolean compareTwoCsvFiles(String path, CSVComparer comparer, PrintStream messageStream) throws CSVReaderException
      Compare two CSV files using a specified comparer.
      Parameters:
      path - relative-path (compared to root of both loaders) of files to compare.
      comparer - the CSVComparer to use for comparing the CSV files.
      messageStream - if non-equal, additional explanation messages are printed here.
      Returns:
      true when the csv-files are identical according to the comparer, false otherwise.
      Throws:
      CSVReaderException - if something goes wrong with csv I/O or a csv file is rejected.
    • compareTwoObjectCollections

      public boolean compareTwoObjectCollections(String path) throws IOException
      Compare two object-mask-collections.
      Parameters:
      path - relative-path (compared to root of both loaders) of files to compare.
      Returns:
      true if both paths return object-collections that are voxelwise identical.
      Throws:
      IOException - if something goes wrong with I/O.
    • compareTwoBinaryFiles

      public boolean compareTwoBinaryFiles(String path) throws IOException
      Compare two binary-files.
      Parameters:
      path - relative-path (compared to root of both loaders) of files to compare.
      Returns:
      true if both paths have binary-files that are bytewise identical.
      Throws:
      IOException - if something goes wrong with I/O.
    • compareTwoSubdirectories

      public boolean compareTwoSubdirectories(String path)
      Compare two subdirectories that have an identical path, but in two different test loaders.
      Parameters:
      path - relative-path (compared to root of both loaders) of subdirectories to compare.
      Returns:
      true when the subdirectories are equal (contain the same files and directories), false otherwise.
    • copyFromPath1ToPath2

      public void copyFromPath1ToPath2(String path) throws IOException
      Copies a file from its path in the first loader, to its path in the second loader.

      Any existing file is replaced.

      Parameters:
      path - relative-path (compared to root of both loaders) of files to copy.
      Throws:
      IOException - if copying fails.
    • getLoader1

      public TestLoader getLoader1()
      The first loader.
    • getLoader2

      public TestLoader getLoader2()
      The second loader.