Class IpsTestFailure

java.lang.Object
org.faktorips.runtime.test.IpsTestFailure

public class IpsTestFailure extends Object
Author:
Jan Ortmann
  • Constructor Details

    • IpsTestFailure

      public IpsTestFailure(IpsTestCaseBase test, Throwable t)
      Creates a new test error. The given test case was aborted because the indicated Throwable has been thrown.
    • IpsTestFailure

      public IpsTestFailure(IpsTestCaseBase test, Object expectedValue, Object actualValue)
      Creates a new test failure that was caused because the given actual value is not equal to the expected value.
    • IpsTestFailure

      public IpsTestFailure(IpsTestCaseBase test, Object expectedValue, Object actualValue, String testObject, String testedAttribute, String message)
      Creates a new test failure that was caused because the given actual value is not equal to the expected value.
    • IpsTestFailure

      public IpsTestFailure(IpsTestCaseBase test)
      Creates a new test failure that was caused because an assertion has failed.
  • Method Details

    • getTestCase

      public IpsTestCaseBase getTestCase()
      Returns the test case that has failed.
    • getTestObject

      public String getTestObject()
      If this is a failed assertion failure then the method returns the path to the test object of the expected result that contains the expected value that is not equal to the actual value.

      Path format: TestParamName/TestParamName .. Example: Policy/Coverage

      If this is an error the method returns null.

    • getTestedAttribute

      public String getTestedAttribute()
      Returns the name of the attribute in the test object where the actual value is not the one expected. If this is an error the method returns null.
    • getMessage

      public String getMessage()
      Returns the message of the test failure. Return null if the failure has no message.
    • isError

      public boolean isError()
      Returns true if the test was aborted because a throwable was thrown.
    • isFailedAssertion

      public boolean isFailedAssertion()
      Returns true if the test failed because an assertion failed.
    • getExpectedValue

      public Object getExpectedValue()
      Returns the value that is expected to be the result of the business logic execution.
    • getActualValue

      public Object getActualValue()
      Returns the actual value found after executing the business logic.
      See Also:
    • getActualValueAsString

      public String getActualValueAsString()
      Returns a string representing the actual value. This value should be used instead of getActualValue().toString() when serializing and deserializing, as toString() might return additional formatting. If the actual value is null, "<null>" is returned.
      See Also:
    • getThrowable

      public Throwable getThrowable()
      Returns the throwable object (any kind of exception or error which occurs during the test run).
    • toString

      public String toString()
      Returns a string representation of the IPS test failure.
      Overrides:
      toString in class Object