Class ExampleTestUtil


  • public final class ExampleTestUtil
    extends java.lang.Object
    Test Utils for Examples.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void deleteOutputFile​(java.lang.String directory, java.lang.String outputFileName)
      Delete output files.
      static void ensureALSOutputValidity​(java.lang.String resourcePath, java.lang.String outputFileName, java.lang.String testResourceFileName)
      This method test the output validity of AlternatingLeastSquareITCase.
      static void ensureOutputValidity​(java.lang.String resourcePath, java.lang.String outputFileName, java.lang.String testResourceFileName)
      Ensures output correctness with the given test resource file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ensureOutputValidity

        public static void ensureOutputValidity​(java.lang.String resourcePath,
                                                java.lang.String outputFileName,
                                                java.lang.String testResourceFileName)
                                         throws java.io.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:
        java.io.IOException - if the output is invalid.
      • ensureALSOutputValidity

        public static void ensureALSOutputValidity​(java.lang.String resourcePath,
                                                   java.lang.String outputFileName,
                                                   java.lang.String testResourceFileName)
                                            throws java.io.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:
        java.lang.RuntimeException - if the output is invalid.
        java.io.IOException - exception.
      • deleteOutputFile

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