Package io.testomat.junit.extractor
Class JunitMetaDataExtractor
- java.lang.Object
-
- io.testomat.junit.extractor.JunitMetaDataExtractor
-
public class JunitMetaDataExtractor extends java.lang.ObjectExtracts metadata and parameters from JUnit test methods. Provides comprehensive test information including titles, IDs, suite names, file paths, and parameter extraction for parameterized tests.
-
-
Constructor Summary
Constructors Constructor Description JunitMetaDataExtractor()JunitMetaDataExtractor(ParameterExtractorService parameterExtractorService)Constructor for testing with custom parameter extractor service.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringextractTestId(java.lang.reflect.Method method)io.testomat.core.model.TestMetadataextractTestMetadata(org.junit.jupiter.api.extension.ExtensionContext context)Extracts complete metadata for a test method.java.lang.ObjectextractTestParameters(org.junit.jupiter.api.extension.ExtensionContext context)Extracts parameters from parameterized tests.booleanisParameterizedTest(org.junit.jupiter.api.extension.ExtensionContext context)Checks if the test method is a parameterized test.
-
-
-
Constructor Detail
-
JunitMetaDataExtractor
public JunitMetaDataExtractor()
-
JunitMetaDataExtractor
public JunitMetaDataExtractor(ParameterExtractorService parameterExtractorService)
Constructor for testing with custom parameter extractor service.- Parameters:
parameterExtractorService- the custom parameter extractor service
-
-
Method Detail
-
extractTestMetadata
public io.testomat.core.model.TestMetadata extractTestMetadata(org.junit.jupiter.api.extension.ExtensionContext context)
Extracts complete metadata for a test method.- Parameters:
context- the JUnit extension context- Returns:
- TestMetadata containing title, ID, suite name, and file path
- Throws:
io.testomat.core.exception.NoMethodInContextException- if no test method is found
-
extractTestParameters
public java.lang.Object extractTestParameters(org.junit.jupiter.api.extension.ExtensionContext context)
Extracts parameters from parameterized tests.- Parameters:
context- the JUnit extension context- Returns:
- parameter object (single value for simple params, Map for multiple/complex params), or null for non-parameterized tests
-
isParameterizedTest
public boolean isParameterizedTest(org.junit.jupiter.api.extension.ExtensionContext context)
Checks if the test method is a parameterized test.- Parameters:
context- the JUnit extension context- Returns:
- true if the test method is annotated with @ParameterizedTest
-
extractTestId
public static java.lang.String extractTestId(java.lang.reflect.Method method)
-
-