Class MethodInfoExtractor
- java.lang.Object
-
- io.testomat.junit.methodexporter.extractors.MethodInfoExtractor
-
public class MethodInfoExtractor extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MethodInfoExtractor()MethodInfoExtractor(LabelExtractor labelExtractor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>extractSuites(com.github.javaparser.ast.body.MethodDeclaration testMethod)Extracts the suite hierarchy for the test method.java.lang.StringgetMethodCode(com.github.javaparser.ast.body.MethodDeclaration method)Generates the complete method code including all annotations, signature and body.java.lang.StringgetTestName(com.github.javaparser.ast.body.MethodDeclaration method)Extracts the test name from the method.booleanisTestSkipped(com.github.javaparser.ast.body.MethodDeclaration method)Determines if the test method should be skipped.
-
-
-
Constructor Detail
-
MethodInfoExtractor
public MethodInfoExtractor()
-
MethodInfoExtractor
public MethodInfoExtractor(LabelExtractor labelExtractor)
-
-
Method Detail
-
getTestName
public java.lang.String getTestName(com.github.javaparser.ast.body.MethodDeclaration method)
Extracts the test name from the method. Returns the value from @DisplayName annotation if present, otherwise returns the method name.- Parameters:
method- the method declaration to extract name from- Returns:
- the test name or method name as fallback
-
getMethodCode
public java.lang.String getMethodCode(com.github.javaparser.ast.body.MethodDeclaration method)
Generates the complete method code including all annotations, signature and body.- Parameters:
method- the method declaration to extract code from- Returns:
- the complete method code as string
-
isTestSkipped
public boolean isTestSkipped(com.github.javaparser.ast.body.MethodDeclaration method)
Determines if the test method should be skipped. Checks for @Disabled/@Ignore annotations and method names starting with "ignore" or "skip".- Parameters:
method- the method declaration to check- Returns:
- true if the test should be skipped, false otherwise
-
extractSuites
public java.util.List<java.lang.String> extractSuites(com.github.javaparser.ast.body.MethodDeclaration testMethod)
Extracts the suite hierarchy for the test method. Traverses from outermost to innermost class, using @DisplayName values when available.- Parameters:
testMethod- the method declaration to extract suites for- Returns:
- list of suite names in hierarchical order
-
-