Class AbstractTestResultConstructor
- java.lang.Object
-
- com.testomatio.reporter.core.constructor.AbstractTestResultConstructor
-
- All Implemented Interfaces:
ResultConstructor
- Direct Known Subclasses:
CucumberTestResultConstructor,JUnitTestResultConstructor,TestNgTestResultConstructor
public abstract class AbstractTestResultConstructor extends Object implements ResultConstructor
Base constructor for framework-specific test case results. Uses template method pattern to handle custom messages vs exception details.
-
-
Constructor Summary
Constructors Constructor Description AbstractTestResultConstructor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected TestResult.BuilderbuildTestResult(TestResultWrapper holder)Builds test result with basic metadata and status.TestResultconstructTestRunResult(TestResultWrapper holder)Constructs test case result from wrapper containing framework-specific data.protected ExceptionDetailscreateExceptionDetails(Throwable throwable)Creates exception details with message and stack trace.protected abstract TestResultcreateWithCustomMessage(TestResultWrapper holder)Creates test result using custom message from wrapper.protected abstract TestResultcreateWithExceptionDetails(TestResultWrapper holder)Creates test result using exception details from framework-specific data.protected abstract StringgetCustomMessage(TestResultWrapper holder)Extracts custom message from wrapper.protected abstract StringgetFrameworkName()Returns name of the test framework for logging purposes.protected abstract booleanhasCustomMessage(TestResultWrapper holder)Checks if wrapper contains custom message for the test result.protected voidlogTestResultCreation(TestResultWrapper holder, boolean hasCustomMessage)Logs test result creation details for debugging.protected voidvalidateHolder(TestResultWrapper holder)Validates that wrapper and its metadata are not null.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.testomatio.reporter.core.constructor.ResultConstructor
extractStackTrace, getStackTrace, isReportableException
-
-
-
-
Method Detail
-
constructTestRunResult
public final TestResult constructTestRunResult(TestResultWrapper holder)
Description copied from interface:ResultConstructorConstructs test case result from wrapper containing framework-specific data.- Specified by:
constructTestRunResultin interfaceResultConstructor- Parameters:
holder- wrapper containing test metadata and framework data- Returns:
- constructed test case result
-
validateHolder
protected final void validateHolder(TestResultWrapper holder)
Validates that wrapper and its metadata are not null.- Parameters:
holder- wrapper to validate- Throws:
IllegalArgumentException- if wrapper or metadata is null
-
logTestResultCreation
protected final void logTestResultCreation(TestResultWrapper holder, boolean hasCustomMessage)
Logs test result creation details for debugging.
-
buildTestResult
protected final TestResult.Builder buildTestResult(TestResultWrapper holder)
Builds test result with basic metadata and status.- Parameters:
holder- wrapper containing test metadata- Returns:
- test result builder with basic fields populated
-
createExceptionDetails
protected final ExceptionDetails createExceptionDetails(Throwable throwable)
Creates exception details with message and stack trace.- Parameters:
throwable- exception to extract details from- Returns:
- exception details object
-
hasCustomMessage
protected abstract boolean hasCustomMessage(TestResultWrapper holder)
Checks if wrapper contains custom message for the test result.
-
getCustomMessage
protected abstract String getCustomMessage(TestResultWrapper holder)
Extracts custom message from wrapper.
-
createWithCustomMessage
protected abstract TestResult createWithCustomMessage(TestResultWrapper holder)
Creates test result using custom message from wrapper.
-
createWithExceptionDetails
protected abstract TestResult createWithExceptionDetails(TestResultWrapper holder)
Creates test result using exception details from framework-specific data.
-
getFrameworkName
protected abstract String getFrameworkName()
Returns name of the test framework for logging purposes.
-
-