Class JUnitTestResultConstructor


  • public class JUnitTestResultConstructor
    extends java.lang.Object
    Constructs test result objects from JUnit test execution context and metadata. This class is responsible for building TestResult instances by extracting relevant information from JUnit's ExtensionContext, including test metadata, execution status, exception details, and parameterized test data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 file
        message - 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