Class ParameterExtractionContext
- java.lang.Object
-
- io.testomat.junit.extractor.strategy.ParameterExtractionContext
-
public class ParameterExtractionContext extends java.lang.ObjectContext object containing all information needed for parameter extraction from parameterized tests. This immutable value object is passed to parameter extraction strategies. Includes centralized parameter name resolution using source code parsing.
-
-
Constructor Summary
Constructors Constructor Description ParameterExtractionContext(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationType)Gets a specific annotation from the test method.java.lang.annotation.Annotation[]getAnnotations()Gets all annotations present on the test method.java.lang.StringgetDisplayName()Gets the display name of the test execution.org.junit.jupiter.api.extension.ExtensionContextgetExtensionContext()Gets the JUnit extension context.java.lang.StringgetParameterName(int parameterIndex)Gets a specific parameter name by index.java.lang.reflect.MethodgetTestMethod()Gets the test method being executed.java.lang.StringgetUniqueId()Gets the unique identifier for this test execution.booleanhasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Checks if the test method has a specific annotation.booleanisValid()Checks if this context represents a valid parameterized test.
-
-
-
Method Detail
-
getExtensionContext
public org.junit.jupiter.api.extension.ExtensionContext getExtensionContext()
Gets the JUnit extension context.- Returns:
- the JUnit extension context
-
getTestMethod
public java.lang.reflect.Method getTestMethod()
Gets the test method being executed.- Returns:
- the test method, or null if not available
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
Gets all annotations present on the test method.- Returns:
- array of annotations on the test method
-
getDisplayName
public java.lang.String getDisplayName()
Gets the display name of the test execution.- Returns:
- the display name of the test execution
-
getUniqueId
public java.lang.String getUniqueId()
Gets the unique identifier for this test execution.- Returns:
- the unique identifier for this test execution
-
hasAnnotation
public boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Checks if the test method has a specific annotation.- Parameters:
annotationType- the annotation type to check for- Returns:
- true if the test method has the specified annotation, false otherwise
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
Gets a specific annotation from the test method.- Type Parameters:
T- the annotation type- Parameters:
annotationType- the annotation type to retrieve- Returns:
- the annotation instance, or null if not present
-
isValid
public boolean isValid()
Checks if this context represents a valid parameterized test.- Returns:
- true if the context has valid test method and extension context, false otherwise
-
getParameterName
public java.lang.String getParameterName(int parameterIndex)
Gets a specific parameter name by index.- Parameters:
parameterIndex- the index of the parameter (0-based)- Returns:
- the parameter name, or "param{index}" as fallback
-
-