public class ComparisonFailure extends AssertionError
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)Constructor and Description |
---|
ComparisonFailure(String message,
String expected,
String actual)
Constructs a comparison failure.
|
Modifier and Type | Method and Description |
---|---|
String |
getActual()
Returns the actual string value
|
String |
getExpected()
Returns the expected string value
|
String |
getMessage()
Returns "..." in place of common prefix and "..." in
place of common suffix between expected and actual.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ComparisonFailure(String message, String expected, String actual)
message
- the identifying message or nullexpected
- the expected string valueactual
- the actual string valuepublic String getMessage()
getMessage
in class Throwable
Throwable.getMessage()
public String getExpected()
Copyright © 2002-2012 JUnit. All Rights Reserved.