Package org.faktorips.runtime.test
Class IpsTestFailure
- java.lang.Object
-
- org.faktorips.runtime.test.IpsTestFailure
-
public class IpsTestFailure extends java.lang.Object- Author:
- Jan Ortmann
-
-
Constructor Summary
Constructors Constructor Description IpsTestFailure(IpsTestCaseBase test)Creates a new test failure that was caused because an assertion has failed.IpsTestFailure(IpsTestCaseBase test, java.lang.Object expectedValue, java.lang.Object actualValue)Creates a new test failure that was caused because the given actual value is not equal to the expected value.IpsTestFailure(IpsTestCaseBase test, java.lang.Object expectedValue, java.lang.Object actualValue, java.lang.String testObject, java.lang.String testedAttribute, java.lang.String message)Creates a new test failure that was caused because the given actual value is not equal to the expected value.IpsTestFailure(IpsTestCaseBase test, java.lang.Throwable t)Creates a new test error.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetActualValue()Returns the actual value found after executing the business logic.java.lang.StringgetActualValueAsString()Returns a string representing the actual value.java.lang.ObjectgetExpectedValue()Returns the value that is expected to be the result of the business logic execution.java.lang.StringgetMessage()Returns the message of the test failure.IpsTestCaseBasegetTestCase()Returns the test case that has failed.java.lang.StringgetTestedAttribute()Returns the name of the attribute in the test object where the actual value is not the one expected.java.lang.StringgetTestObject()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.java.lang.ThrowablegetThrowable()Returns the throwable object (any kind of exception or error which occurs during the test run).booleanisError()Returnstrueif the test was aborted because a throwable was thrown.booleanisFailedAssertion()Returnstrueif the test failed because an assertion failed.java.lang.StringtoString()Returns a string representation of the IPS test failure.
-
-
-
Constructor Detail
-
IpsTestFailure
public IpsTestFailure(IpsTestCaseBase test, java.lang.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, java.lang.Object expectedValue, java.lang.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, java.lang.Object expectedValue, java.lang.Object actualValue, java.lang.String testObject, java.lang.String testedAttribute, java.lang.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 Detail
-
getTestCase
public IpsTestCaseBase getTestCase()
Returns the test case that has failed.
-
getTestObject
public java.lang.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 java.lang.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 returnsnull.
-
getMessage
public java.lang.String getMessage()
Returns the message of the test failure. Returnnullif the failure has no message.
-
isError
public boolean isError()
Returnstrueif the test was aborted because a throwable was thrown.
-
isFailedAssertion
public boolean isFailedAssertion()
Returnstrueif the test failed because an assertion failed.
-
getExpectedValue
public java.lang.Object getExpectedValue()
Returns the value that is expected to be the result of the business logic execution.
-
getActualValue
public java.lang.Object getActualValue()
Returns the actual value found after executing the business logic.- See Also:
getActualValueAsString()
-
getActualValueAsString
public java.lang.String getActualValueAsString()
Returns a string representing the actual value. This value should be used instead ofgetActualValue().toString()when serializing and deserializing, astoString()might return additional formatting. If the actual value isnull,"<null>"is returned.- See Also:
getActualValue()
-
getThrowable
public java.lang.Throwable getThrowable()
Returns the throwable object (any kind of exception or error which occurs during the test run).
-
toString
public java.lang.String toString()
Returns a string representation of the IPS test failure.- Overrides:
toStringin classjava.lang.Object
-
-