Class AllInclassMethodTests


  • public class AllInclassMethodTests
    extends java.lang.Object
    Utility class to collect all methods annotated with @TestMethod from a given location of compiled Java classes.
    Author:
    dfahland
    • Constructor Detail

      • AllInclassMethodTests

        public AllInclassMethodTests()
    • Method Detail

      • getAllTestMethods

        public java.util.List<java.lang.reflect.Method> getAllTestMethods()
        Returns:
        all found methods
      • collectAllTestMethods

        public void collectAllTestMethods​(java.lang.String lookUpDir)
        Find all methods with annotation @TestMethod in the given loop up directory. The classes can be stored inside a JAR file. The list of found methods can be retrieved with getAllTestMethods(). This method can be run several times to scan classes from different directories.
        Parameters:
        lookUpDir -
      • testExpectedFromFile

        public static boolean testExpectedFromFile​(java.lang.reflect.Method method)
        Parameters:
        method -
        Returns:
        true iff the method is annotated with TestMethod.filename(). Then the result of the test will be compared to the contents of a file.
      • testExpectedFromOutputAnnotation

        public static boolean testExpectedFromOutputAnnotation​(java.lang.reflect.Method method)
        Parameters:
        method -
        Returns:
        true iff the method is annotated with TestMethod.output(). Then the result of the test will be compared to the specified string.
      • testResultFromSystemOut

        public static boolean testResultFromSystemOut​(java.lang.reflect.Method method)
        Parameters:
        method -
        Returns:
        true iff the method is annotated with TestMethod.returnSystemOut() == true. Then the return result of the method will be everything the method wrote to System.out.
      • getTestName

        public static java.lang.String getTestName​(java.lang.reflect.Method m)
      • test_basicOutputTest

        public static java.lang.String test_basicOutputTest()
      • test_basicFileTest

        public static java.lang.String test_basicFileTest()
      • test_dualTest

        public static java.lang.String test_dualTest()
      • test_basicFileTest_OutputStream

        public static java.lang.String test_basicFileTest_OutputStream()