Class FileFinder
- java.lang.Object
-
- io.testomat.junit.methodexporter.filefinder.FileFinder
-
public class FileFinder extends java.lang.ObjectLocates source files for test classes in various common directory structures. This class searches through standard Maven/Gradle directory layouts to find the corresponding .java source file for a given test class.
-
-
Constructor Summary
Constructors Constructor Description FileFinder()FileFinder(PathNormalizer normalizer)Constructor for testing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringextractRelativeFilePath(java.lang.String filepath)Extracts package-relative file path from full file path.java.lang.StringgetPath(org.junit.jupiter.api.extension.ExtensionContext context)java.lang.StringgetTestClassFilePath(java.lang.Class<?> testClass)Finds the source file path for the given test class.
-
-
-
Constructor Detail
-
FileFinder
public FileFinder()
-
FileFinder
public FileFinder(PathNormalizer normalizer)
Constructor for testing- Parameters:
normalizer- the path normalizer
-
-
Method Detail
-
getTestClassFilePath
public java.lang.String getTestClassFilePath(java.lang.Class<?> testClass)
Finds the source file path for the given test class. Searches through common source directory structures including Maven and Gradle layouts.- Parameters:
testClass- the test class to locate- Returns:
- the file path to the source file, or null if not found
-
getPath
public java.lang.String getPath(org.junit.jupiter.api.extension.ExtensionContext context)
-
extractRelativeFilePath
public java.lang.String extractRelativeFilePath(java.lang.String filepath)
Extracts package-relative file path from full file path. Updated to work similarly to TestNgFileFinder but for JUnit context.- Parameters:
filepath- the full file path to process- Returns:
- the relative file path from the package root, or "UnknownFile.java" if path is invalid
-
-