Class TestFailure


  • public class TestFailure
    extends java.lang.Object
    A TestFailure collects a failed test together with the caught exception.
    See Also:
    TestResult
    • Constructor Summary

      Constructors 
      Constructor Description
      TestFailure​(Test failedTest, java.lang.Throwable thrownException)
      Constructs a TestFailure with the given test and exception.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String exceptionMessage()
      Returns a String containing the message from the thrown exception.
      Test failedTest()
      Gets the failed test.
      boolean isFailure()
      Returns true if the error is considered a failure (i.e.
      java.lang.Throwable thrownException()
      Gets the thrown exception.
      java.lang.String toString()
      Returns a short description of the failure.
      java.lang.String trace()
      Returns a String containing the stack trace of the error thrown by TestFailure.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TestFailure

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

      • thrownException

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

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

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

        public java.lang.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.