Class ExampleTestUtil


  • public final class ExampleTestUtil
    extends Object
    Test Utils for Examples.
    • Method Detail

      • ensureOutputValidity

        public static void ensureOutputValidity​(String resourcePath,
                                                String outputFileName,
                                                String testResourceFileName)
                                         throws IOException
        Ensures output correctness with the given test resource file.
        Parameters:
        resourcePath - root folder for both resources.
        outputFileName - output file name.
        testResourceFileName - the test result file name.
        Throws:
        IOException - if the output is invalid.
      • ensureALSOutputValidity

        public static void ensureALSOutputValidity​(String resourcePath,
                                                   String outputFileName,
                                                   String testResourceFileName)
                                            throws IOException
        This method test the output validity of AlternatingLeastSquareITCase. Due to the floating point math error, the output of the test can be different every time. Thus we cannot compare plain text output, but have to check its numeric error.
        Parameters:
        resourcePath - path to resources.
        outputFileName - name of output file.
        testResourceFileName - name of the file to compare the outputs to.
        Throws:
        RuntimeException - if the output is invalid.
        IOException - exception.
      • deleteOutputFile

        public static void deleteOutputFile​(String directory,
                                            String outputFileName)
                                     throws IOException
        Delete output files.
        Parameters:
        directory - the path of file directory.
        outputFileName - the output file prefix.
        Throws:
        IOException - if fail to delete.