All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.applitools.eyes.exceptions.TestFailedException Maven / Gradle / Ivy

There is a newer version: 5.76.0
Show newest version
/*
 * Applitools software.
 */
package com.applitools.eyes.exceptions;

import com.applitools.eyes.TestResults;

/**
 * Indicates that a test did not pass (i.e., test either failed or is a new test).
 */
public class TestFailedException extends AssertionError {
    private TestResults testResults = null;

    public TestFailedException(TestResults testResults, String scenarioIdOrName, String appIdOrName) {
        super(String.format("'%s' of '%s'. See details at %s",
                scenarioIdOrName,
                appIdOrName,
                testResults.getUrl()));
        this.testResults = testResults;
    }

    public TestFailedException(TestResults testResults, String message) {
        super(message);
        this.testResults = testResults;
    }


    /**
     * Creates a new TestFailedException instance.
     * @param message A description string.
     */
    public TestFailedException(String message) {
        this(null, message);
    }

    /**
     * Creates an EyesException instance.
     * {@code testResults} default to {@code null}.
     * @param message A description of the error.
     * @param cause The cause for this exception.
     */
    public TestFailedException(String message, Throwable cause) {
        super(message, cause);
    }

    /**
     * @return The failed test results, or {@code null} if the test has not
     * yet ended (e.g., when thrown due to
     * {@link com.applitools.eyes.FailureReports#IMMEDIATE} settings).
     */
    public TestResults getTestResults() {
        return testResults;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy