Class StackTraceTestFinderUtil

java.lang.Object
org.approvej.verify.StackTraceTestFinderUtil

@NullMarked public class StackTraceTestFinderUtil extends Object
Utility class to find the current test method using the stack trace.
  • Method Details

    • findTestSourcePath

      public static Path findTestSourcePath(Method testMethod)
      Finds the source path of the test method, making the following assumptions:
      • the test class' name is also the name of the source file,
      • the file is at most 10 levels deep,
      • the filename extension of the file is java, kt, or groovy
      Parameters:
      testMethod - the test Method
      Returns:
      the Path to the source file containing the given testMethod