Class ComparisonFailure
java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.AssertionError
org.junit.ComparisonFailure
- All Implemented Interfaces:
Serializable
Thrown when an
assertEquals(String, String) fails.
Create and throw a ComparisonFailure manually if you want to show users the
difference between two complex strings.
Inspired by a patch from Alex Chaffee (alex@purpletech.com)- Since:
- 4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionComparisonFailure(String message, String expected, String actual) Constructs a comparison failure. -
Method Summary
Modifier and TypeMethodDescriptionReturns the actual string valueReturns the expected string valueReturns "..." in place of common prefix and "..." in place of common suffix between expected and actual.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ComparisonFailure
-
-
Method Details
-
getMessage
Returns "..." in place of common prefix and "..." in place of common suffix between expected and actual.- Overrides:
getMessagein classThrowable- See Also:
-
getActual
-
getExpected
-