Class TestFailure


  • public class TestFailure
    extends Object
    A TestFailure collects a failed test together with the caught exception.
    See Also:
    TestResult
    • Field Detail

      • fFailedTest

        protected Test fFailedTest
      • fThrownException

        protected Throwable fThrownException
    • Constructor Detail

      • TestFailure

        public TestFailure​(Test failedTest,
                           Throwable thrownException)
        Constructs a TestFailure with the given test and exception.
    • Method Detail

      • failedTest

        public Test failedTest()
        Gets the failed test.
      • thrownException

        public Throwable thrownException()
        Gets the thrown exception.
      • toString

        public String toString()
        Returns a short description of the failure.
        Overrides:
        toString in class Object
      • trace

        public String trace()
        Returns a String containing the stack trace of the error thrown by TestFailure.
      • exceptionMessage

        public String exceptionMessage()
        Returns a String containing the message from the thrown exception.
      • isFailure

        public boolean isFailure()
        Returns true if the error is considered a failure (i.e. if it is an instance of AssertionFailedError), false otherwise.