Package io.testomat.junit.constructor
Class JUnitTestResultConstructor
- java.lang.Object
-
- io.testomat.junit.constructor.JUnitTestResultConstructor
-
public class JUnitTestResultConstructor extends java.lang.ObjectConstructs test result objects from JUnit test execution context and metadata. This class is responsible for buildingTestResultinstances by extracting relevant information from JUnit'sExtensionContext, including test metadata, execution status, exception details, and parameterized test data.
-
-
Constructor Summary
Constructors Constructor Description JUnitTestResultConstructor()Creates a new JUnitTestResultConstructor with a default metadata extractor.JUnitTestResultConstructor(JunitMetaDataExtractor metaDataExtractor)Creates a new JUnitTestResultConstructor with the specified metadata extractor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.testomat.core.model.TestResultconstructTestRunResult(io.testomat.core.model.TestMetadata metadata, java.lang.String message, java.lang.String status, org.junit.jupiter.api.extension.ExtensionContext context)Constructs a test result from the provided metadata and execution context.
-
-
-
Constructor Detail
-
JUnitTestResultConstructor
public JUnitTestResultConstructor()
Creates a new JUnitTestResultConstructor with a default metadata extractor.
-
JUnitTestResultConstructor
public JUnitTestResultConstructor(JunitMetaDataExtractor metaDataExtractor)
Creates a new JUnitTestResultConstructor with the specified metadata extractor.- Parameters:
metaDataExtractor- the metadata extractor to use for extracting test information- Throws:
java.lang.NullPointerException- if metaDataExtractor is null
-
-
Method Detail
-
constructTestRunResult
public io.testomat.core.model.TestResult constructTestRunResult(io.testomat.core.model.TestMetadata metadata, java.lang.String message, java.lang.String status, org.junit.jupiter.api.extension.ExtensionContext context)Constructs a test result from the provided metadata and execution context. This method processes both regular and parameterized tests, extracting exception details when available and preserving test parameters for parameterized tests.- Parameters:
metadata- the test metadata containing suite title, test ID, title, and filemessage- the test message (if null, will be extracted from context exception)status- the test execution status (e.g., "passed", "failed", "skipped")context- the JUnit extension context containing execution details- Returns:
- a complete TestResult object with all available information
-
-